結果
問題 |
No.2895 Zero XOR Subset
|
ユーザー |
![]() |
提出日時 | 2024-09-20 22:29:02 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
MLE
|
実行時間 | - |
コード長 | 720 bytes |
コンパイル時間 | 483 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 818,160 KB |
最終ジャッジ日時 | 2024-09-20 22:29:06 |
合計ジャッジ時間 | 3,341 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | MLE * 1 -- * 34 |
ソースコード
import sys input = sys.stdin.readline N=int(input()) A=list(map(int,input().split())) # xorの掃き出し法・基底 BASE=[] def sweep(x): LIST=[] for b,LI in BASE: if b^x<x: x=b^x LIST+=LI return x,LIST for i in range(N): x=A[i] k=sweep(x) if k[0]!=0: # 掃き出した値が0でないなら基底に入れる。 BASE.append((k[0],k[1]+[i])) else: ANS=k[1]+[i] ANS.sort() LA=[] for ans in ANS: if LA and LA[-1]==ans: LA.pop() else: LA.append(ans) print(len(ANS)) for ans in ANS: print(ans+1) break else: print(-1)