Submission #5010853
Source Code Expand
# -*- coding: utf-8 -*- import sys from collections import Counter from functools import reduce from operator import xor def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def ceil(x, y=1): return int(-(-x // y)) def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) def Yes(): print('Yes') def No(): print('No') def YES(): print('YES') def NO(): print('NO') sys.setrecursionlimit(10 ** 9) INF = float('inf') MOD = 10 ** 9 + 7 N=INT() A=[INT() for i in range(N)] mnbit=[0]*N for i, a in enumerate(A): bina=format(a, 'b') mnbit[i]=len(bina)-bina.rfind('1') C=Counter(mnbit) res=format(reduce(xor, A, 0), 'b') cnt=0 ln=len(res) for i in range(ln): idx=len(res)-i if res[i]=='1': if C[idx]: res=format(int(res, 2)^int('1'*idx, 2), '0'+str(ln)+'b') cnt+=1 else: print(-1) exit() print(cnt)
Submission Info
Submission Time | |
---|---|
Task | C - Cheating Nim |
User | Coki628 |
Language | Python (3.4.3) |
Score | 500 |
Code Size | 1120 Byte |
Status | AC |
Exec Time | 182 ms |
Memory | 8432 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 | 23 ms | 3680 KB |
001.txt | AC | 23 ms | 3680 KB |
002.txt | AC | 173 ms | 8428 KB |
003.txt | AC | 108 ms | 6104 KB |
004.txt | AC | 98 ms | 5868 KB |
005.txt | AC | 67 ms | 5104 KB |
006.txt | AC | 181 ms | 8432 KB |
007.txt | AC | 176 ms | 8432 KB |
008.txt | AC | 180 ms | 8428 KB |
009.txt | AC | 173 ms | 8428 KB |
010.txt | AC | 179 ms | 8428 KB |
011.txt | AC | 169 ms | 8428 KB |
012.txt | AC | 176 ms | 8428 KB |
013.txt | AC | 181 ms | 8428 KB |
014.txt | AC | 179 ms | 8428 KB |
015.txt | AC | 182 ms | 8428 KB |
016.txt | AC | 182 ms | 8428 KB |
017.txt | AC | 176 ms | 8428 KB |
018.txt | AC | 175 ms | 8432 KB |
019.txt | AC | 173 ms | 8432 KB |
020.txt | AC | 176 ms | 8432 KB |
021.txt | AC | 37 ms | 3936 KB |
022.txt | AC | 38 ms | 3936 KB |
023.txt | AC | 178 ms | 8428 KB |
example0.txt | AC | 23 ms | 3680 KB |
example1.txt | AC | 23 ms | 3680 KB |