Submission #4417552
Source Code Expand
N = int(input()) A = [int(input()) for i in range(N)] # 全体のxorを計算 XOR = 0 for a in A: XOR ^= a ans = 0 for i in reversed(range(30)): if not ((1 << i) & XOR): continue for j, a in enumerate(A): a_bit = bin(a)[2:].zfill(30) if a_bit[30 - i - 1:] == '1' + '0' * i: ans += 1 XOR ^= a XOR ^= (a - 1) del A[j] break else: print(-1) exit() print(ans)
Submission Info
Submission Time | |
---|---|
Task | C - Cheating Nim |
User | AT274 |
Language | Python (3.4.3) |
Score | 500 |
Code Size | 506 Byte |
Status | AC |
Exec Time | 252 ms |
Memory | 7072 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 | 18 ms | 3060 KB |
001.txt | AC | 18 ms | 3060 KB |
002.txt | AC | 182 ms | 7072 KB |
003.txt | AC | 116 ms | 5024 KB |
004.txt | AC | 129 ms | 5016 KB |
005.txt | AC | 88 ms | 4252 KB |
006.txt | AC | 184 ms | 7072 KB |
007.txt | AC | 171 ms | 7072 KB |
008.txt | AC | 180 ms | 7068 KB |
009.txt | AC | 176 ms | 7072 KB |
010.txt | AC | 185 ms | 7068 KB |
011.txt | AC | 176 ms | 7064 KB |
012.txt | AC | 181 ms | 7068 KB |
013.txt | AC | 181 ms | 7072 KB |
014.txt | AC | 186 ms | 7072 KB |
015.txt | AC | 176 ms | 7072 KB |
016.txt | AC | 244 ms | 7068 KB |
017.txt | AC | 247 ms | 7072 KB |
018.txt | AC | 175 ms | 7068 KB |
019.txt | AC | 186 ms | 7072 KB |
020.txt | AC | 252 ms | 7064 KB |
021.txt | AC | 39 ms | 3316 KB |
022.txt | AC | 40 ms | 3316 KB |
023.txt | AC | 250 ms | 7068 KB |
example0.txt | AC | 18 ms | 3060 KB |
example1.txt | AC | 18 ms | 3060 KB |