Bob's Primes

View as PDF

Submit solution

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

Problem types
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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 amount 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 contains 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


Sample Output

its primetime

Explanation of Output

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

Sample Input


Sample Output

not primetime

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


  • 5
    ross_cleary  commented on July 12, 2020, 9:00 p.m.

    15 points to 7 points that’s a tough soak.

  • 0
    Dingledooper  commented on July 11, 2019, 9:01 p.m. edited

    Edit: Fixed

  • -3
    TheZombieCloud  commented on July 9, 2017, 1:20 p.m.

    Grammatical Error

    The amount of each object is a prime number.

    "amount" should be changed to "number".

    Misread the question because of this.

  • 4
    P234rex  commented on Feb. 1, 2017, 3:02 p.m.

    I didn't quite mean to but I think I cheesed the problem. Was my solution intended to work?

    • 8
      r3mark  commented on Feb. 1, 2017, 3:22 p.m.


  • 2
    P234rex  commented on Feb. 1, 2017, 10:19 a.m.

    Sample input 2, one of the prices seems to be outside of the given range of numbers.

    • 2
      Kirito  commented on Feb. 1, 2017, 2:56 p.m.

      Statement has been fixed. In addition, m_i is actually in the range [1, 100]. This change has been reflected in the problem statement.

  • 1
    gloomcore  commented on Dec. 17, 2016, 11:14 a.m.

    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, 7:23 p.m.

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

  • 3
    r3mark  commented on April 22, 2016, 11:37 a.m.

    How did my submission pass?

    • 2
      moladan123  commented on April 23, 2016, 6:14 p.m.

      What exactly is the problem?

      • 3
        r3mark  commented on April 23, 2016, 6:30 p.m.

        Check this out: Problemsetters can view submissions during the contest, right?

        • 2
          moladan123  commented on April 23, 2016, 9:14 p.m.

          I see the problem now. As the contest is going on right now I cant change anything. Once the contest is over I will a few more hand made test cases to make sure only the correct solutions pass. For now, enjoy your temporary points ;)

          • 4
            aeternalis1  commented on Aug. 26, 2017, 3:57 p.m.

            Just so you know, the test cases are still sub par and AC incorrect answers. If you have the time you should write some more up.

        • 3
          bobhob314  commented on April 23, 2016, 8:26 p.m.

          I'm not sure about moladan123 so I've sent him the code via fb.

    • 4
      bobhob314  commented on April 22, 2016, 2:21 p.m.

      I'll ask the problemsetter.

  • 2
    razvand  commented on April 22, 2016, 9:10 a.m.

    One of the conditions stated is that "(2<mi<100)" even tho the first input has the value m1 = 2 which is not stricly greater than 2.