TSOC '16 Contest 2 #4 - Bob's Primes

View as PDF

Submit solution

Points: 7
Time limit: 1.0s
Memory limit: 512M

Author:
Problem types

If there is anything that bobhob314 likes, it is prime numbers. He likes them so much, he decided to throw his friend a prime party.

In order to make a prime themed birthday party, bobhob314 has n (0 < n < 10\,000) dollars to spend on various goods. He also has a list of m (0 < m < 100) objects that he needs to buy that each cost m_i (1 \le m_i \le 100) dollars.

He needs to buy the objects such that:

  1. He buys each object at least twice.

  2. The number of each object is a prime number.

  3. He spends a prime amount of money.

Input Specification

The first line contains the integer n, the amount of money that he can spend.

The second line contains the integer m, the number of objects he has to buy.

The next m lines contain m_i, the price of each object. Each price is unique.

Output Specification

If it is possible to achieve the above goals, output its primetime. Otherwise, output not primetime.

Sample Input 1

31
2
3
5

Sample Output 1

its primetime

Explanation for Sample Output 1

bobhob314 can buy 2 objects worth 3 dollars and 5 objects worth 5 dollars for a total of 31 dollars.

Sample Input 2

2
1
97

Sample Output 2

not primetime

bobhob314 is too poor to buy anything, so the party can't go on.


Comments


  • 1
    gloomcore  commented on Dec. 17, 2016, 4:14 p.m. edited

    For sample 1, user can also buy 3 objects worth 3 dollars, and 2 objects worth 5 dollars, spending in total 19 dollars.
    Is it acceptable solution? Or user should spend directly n dollars?


  • 4
    atarw  commented on Aug. 28, 2016, 11:23 p.m. edited

    you have to buy each object at least twice but in sample input 1 this doesn't happen :)