Submission #3389178


Source Code Expand

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

s = 0
L = [False]*22
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 0
Code Size 422 Byte
Status RE
Exec Time 340 ms
Memory 7072 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 8
RE × 18
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 133 ms 5024 KB
004.txt AC 107 ms 5016 KB
005.txt AC 77 ms 4248 KB
006.txt RE 162 ms 7068 KB
007.txt RE 169 ms 7072 KB
008.txt RE 167 ms 7068 KB
009.txt RE 170 ms 7072 KB
010.txt RE 172 ms 7072 KB
011.txt RE 169 ms 7072 KB
012.txt RE 162 ms 7072 KB
013.txt RE 162 ms 7072 KB
014.txt RE 168 ms 7068 KB
015.txt RE 164 ms 7072 KB
016.txt RE 161 ms 7064 KB
017.txt RE 166 ms 7068 KB
018.txt RE 163 ms 7072 KB
019.txt RE 160 ms 7064 KB
020.txt RE 168 ms 7072 KB
021.txt RE 30 ms 3316 KB
022.txt RE 31 ms 3316 KB
023.txt RE 171 ms 7064 KB
example0.txt AC 17 ms 3064 KB
example1.txt AC 17 ms 3064 KB