結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー 👑 Kazun
提出日時 2021-05-03 00:45:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 5,000 ms
コード長 1,353 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 96,768 KB
最終ジャッジ日時 2024-07-21 09:55:25
合計ジャッジ時間 6,264 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

class XOR_Vector_Space:
def __init__(self):
self.S=[]
def __contains__(self,x):
for v in self.S:
if x&v&(-v):
x^=v
if x==0:
return True
return False
def __add__(self,other):
W=XOR_Vector_Space()
W.S=self.S[:]
W.add_vector(*other.S)
return W
def add_vector(self,*T):
for x in T:
for v in self.S:
if x&v&(-v):
x^=v
if x==0:
break
if x:
self.S.append(x)
def dim(self):
return len(self.S)
def reduction(self):
S=self.S
for i in range(len(S)):
vb=S[i]&(-S[i])
for j in range(len(S)):
if i==j: continue
if S[j]&vb:
S[j]^=S[i]
self.S=[s for s in S if s]
def __le__(self,other):
for u in self.S:
if not u in other:
return False
return True
def __ge__(self,other):
return other<=self
def __eq__(self,other):
return (self<=other) and (other<=self)
#================================================
N=int(input())
A=list(map(int,input().split()))
V=XOR_Vector_Space()
V.add_vector(*A)
print(pow(2,V.dim()))
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0