Submission #4421424
Source Code Expand
from functools import reduce from operator import xor N = int(input()) As = [int(input()) for _ in range(N)] dXORs = set([A ^ (A-1) for A in As]) XOR = reduce(xor, As) ans = 0 for i in reversed(range(30)): if XOR & (1<<i): d = ((1<<(i+1)) - 1) if d in dXORs: XOR ^= d ans += 1 print(ans if XOR == 0 else -1)
Submission Info
Submission Time | |
---|---|
Task | C - Cheating Nim |
User | ZollingerPython3 |
Language | Python (3.4.3) |
Score | 500 |
Code Size | 374 Byte |
Status | AC |
Exec Time | 199 ms |
Memory | 11528 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
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 | 28 ms | 3700 KB |
001.txt | AC | 22 ms | 3572 KB |
002.txt | AC | 196 ms | 11528 KB |
003.txt | AC | 123 ms | 6024 KB |
004.txt | AC | 100 ms | 5896 KB |
005.txt | AC | 72 ms | 5000 KB |
006.txt | AC | 189 ms | 10748 KB |
007.txt | AC | 185 ms | 10760 KB |
008.txt | AC | 195 ms | 10760 KB |
009.txt | AC | 182 ms | 10756 KB |
010.txt | AC | 190 ms | 10756 KB |
011.txt | AC | 192 ms | 10752 KB |
012.txt | AC | 197 ms | 10752 KB |
013.txt | AC | 191 ms | 10760 KB |
014.txt | AC | 192 ms | 10764 KB |
015.txt | AC | 186 ms | 10764 KB |
016.txt | AC | 199 ms | 10876 KB |
017.txt | AC | 190 ms | 10752 KB |
018.txt | AC | 196 ms | 10616 KB |
019.txt | AC | 188 ms | 10768 KB |
020.txt | AC | 194 ms | 10888 KB |
021.txt | AC | 38 ms | 4196 KB |
022.txt | AC | 38 ms | 4192 KB |
023.txt | AC | 187 ms | 11528 KB |
example0.txt | AC | 22 ms | 3572 KB |
example1.txt | AC | 23 ms | 3572 KB |