VM7WC '16 #1 Silver - Project Feng: Multiple Statements

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 62M

Problem type
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

Logic is not taught in Canadian math classes anymore, and Leo sets out to fix that by adding this logic question to Project Feng.

Leo will give you N, (1 \leq N \leq 64) statements, like so:

Exactly A_1 of these statements are true.

Exactly A_2 of these statements are true.

Exactly A_3 of these statements are true.


Exactly A_N of these statements are true.

0 \leq A_i \leq 64 for all i. Leo tells you that some of these statements are true, and others are false. He then asks you, how many of these statements are true?

Input Specification

The first line will contain the positive integer N. The next N lines each contain a single positive integer, the sequence A_1 to A_N.

Output Specification

Output a single nonnegative integer, the number of statements that are true. If there are multiple correct answers, output the greatest. If there are no possible answers, output Paradox!.

Sample Input 1


Sample Output 1


Sample Input 2


Sample Output 2


Sample Input 3


Sample Output 3


Explanation for Sample 3

This is an Epimenides paradox. If the statement is true, then it must be false. It the statement is false, then it must be true.


  • -1
    mrmackamoo  commented on Aug. 14, 2019, 8:20 p.m.

    I've completed every test case except for 4, 6, 12. Can someone explain how 0 can be an answer?

  • 0
    nikos  commented on Sept. 23, 2017, 9:06 p.m. edited

    Hello World! What the heck is going on?!! I tried my code with A TON OF TEST CASES MYSELF, but it doesn't work. Maybe I'm stupid but I am genuinely confused! my code: n = int(raw_input()) a = [] for i in range(0, n): a.append(int(raw_input())) m = 0 for i in range(0, n + 1): if i == a.count(i): m = i if m != 0: print m else: print "Paradox!" python2

  • -1
    m4m3sh1b4  commented on Sept. 22, 2017, 9:25 p.m. edit 3

    help I'm always getting 4, 6, and 12 wrong and I don't know why. I think my code is right... Also should 4 1 2 2 4 print 2 or 4?

    • -2
      pro  commented on Sept. 22, 2017, 10:06 p.m. edit 2

      Same question

    • -2
      aeternalis1  commented on Sept. 22, 2017, 9:52 p.m. edited

      That test case should print 2. I think your program needs to differentiate between a paradox and 0.

      • -2
        m4m3sh1b4  commented on Sept. 23, 2017, 10:20 a.m.

        It does, I don't know why it doesn't work!!!

  • -1
    ceongh  commented on Jan. 13, 2016, 1:36 p.m.

    call me dumb but i seriously dont know how its defining either a number is true of false.

    • -2
      JeffreyZ  commented on Jan. 13, 2016, 7:16 p.m.

      Are you talking about the paradox case?

      • 1
        ceongh  commented on Jan. 14, 2016, 10:41 a.m.

        no in general. i dont understand the problem as a whole. how do i know if a number is true?

  • -1
    atarw  commented on Jan. 8, 2016, 1:46 p.m. edited

    I’m pretty sure that there is probably some error with my program, but by any chance are there any A values which are greater than N (in the test cases)?

    • -1
      JeffreyZ  commented on Jan. 9, 2016, 6:41 p.m. edited

      No, you're right. Sorry for not picking up this earlier, most solutions don't depend on the limit of A\_i.

      Problem statement fixed.

  • -1
    d  commented on Jan. 7, 2016, 4:04 p.m.

    You can print out zero.

    • -1
      cheesecake  commented on Jan. 7, 2016, 4:17 p.m.


      • -1
        moladan123  commented on Jan. 8, 2016, 8:52 p.m.

        Not according to my screen

    • -2
      ZQFMGB12  commented on Jan. 7, 2016, 4:07 p.m.

      Can confirm - if you print 0, you get some test cases correct.