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

View as PDF

Submit solution

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

Author:
Problem type

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 \le N \le 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 \le A_i \le 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

4
0
1
2
3

Sample Output 1

1

Sample Input 2

4
4
4
4
4

Sample Output 2

4

Sample Input 3

1
0

Sample Output 3

Paradox!

Explanation for Sample 3

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


Comments


  • -2
    m4m3sh1b4  commented on Sept. 23, 2017, 1:25 a.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
      aeternalis1  commented on Sept. 23, 2017, 1:52 a.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, 2:20 p.m.

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


  • -1
    ceongh  commented on Jan. 13, 2016, 6: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. 14, 2016, 12:16 a.m.

      Are you talking about the paradox case?


      • 1
        ceongh  commented on Jan. 14, 2016, 3:41 p.m.

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


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

    You can print out zero.


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

      Fixed.


      • -1
        moladan123  commented on Jan. 9, 2016, 1:52 a.m.

        Not according to my screen


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

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