Submission #3389187


Source Code Expand

N = int(input())
A = [int(input()) for i in range(N)]

s = 0
L = [False]*44
for a in A:
    s ^= a
    c = 0
    while a&1==0:
        c += 1
        a >>= 1
    L[c] = True
if s==0:
    print(0)
    exit()
ss = "0" + bin(s)[2:]
ans = 0
for i in range(len(ss)-1):
    if ss[-1-i] != ss[-2-i]:
        if L[i]:
            ans += 1
        else:
            print(-1)
            exit()
print(ans)

Submission Info

Submission Time
Task C - Cheating Nim
User nagiss
Language Python (3.4.3)
Score 500
Code Size 422 Byte
Status AC
Exec Time 631 ms
Memory 7072 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 26
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt AC 17 ms 3064 KB
001.txt AC 17 ms 3064 KB
002.txt AC 340 ms 7072 KB
003.txt AC 136 ms 5020 KB
004.txt AC 108 ms 5016 KB
005.txt AC 73 ms 4256 KB
006.txt AC 450 ms 7068 KB
007.txt AC 451 ms 7072 KB
008.txt AC 535 ms 7068 KB
009.txt AC 446 ms 7072 KB
010.txt AC 452 ms 7072 KB
011.txt AC 445 ms 7072 KB
012.txt AC 526 ms 7072 KB
013.txt AC 449 ms 7068 KB
014.txt AC 499 ms 7072 KB
015.txt AC 441 ms 7072 KB
016.txt AC 513 ms 7068 KB
017.txt AC 446 ms 7072 KB
018.txt AC 460 ms 7064 KB
019.txt AC 454 ms 7068 KB
020.txt AC 524 ms 7068 KB
021.txt AC 53 ms 3316 KB
022.txt AC 62 ms 3316 KB
023.txt AC 631 ms 7068 KB
example0.txt AC 17 ms 3064 KB
example1.txt AC 17 ms 3064 KB