結果
問題 | No.2672 Subset Xor Sum |
ユーザー |
|
提出日時 | 2024-03-15 23:38:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 238 ms / 2,000 ms |
コード長 | 1,338 bytes |
コンパイル時間 | 341 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 152,876 KB |
最終ジャッジ日時 | 2024-09-30 04:25:41 |
合計ジャッジ時間 | 6,799 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 66 |
ソースコード
import sys # import bisect #二分探索 # import math from collections import deque from collections import defaultdict def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int, sys.stdin.readline().rstrip().split()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int, sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) # 1次元の配列 # list(map(int, input().split())) # 2次元の配列 # [list(map(int, input().split())) for i in range()] # wsl pypy3 ファイル名 input = sys.stdin.readline from collections import Counter, defaultdict def XOR_Basis(lst): xor_basis=[] triangulation=[] for x in lst: xx=x for xb in triangulation: xx=min(xx,xx^xb) if xx: xor_basis.append(x) triangulation.append(xx) return xor_basis,triangulation N = I() A = LI() total_xor = 0 for a in A: total_xor ^= a if total_xor != 0: print("No") exit() _,tria=XOR_Basis(A) K=0 for x in tria: if K^x<K: K^=x ans=pow(2,N-len(tria),10**9+7) if ans == 2: print("No") else: print("Yes")