結果

問題 No.2895 Zero XOR Subset
ユーザー 2000 Ekiben2000 Ekiben
提出日時 2024-09-20 22:09:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 116,736 KB
最終ジャッジ日時 2024-09-20 22:09:52
合計ジャッジ時間 6,047 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
66,688 KB
testcase_01 AC 65 ms
66,944 KB
testcase_02 AC 156 ms
116,480 KB
testcase_03 AC 78 ms
71,808 KB
testcase_04 AC 76 ms
71,552 KB
testcase_05 AC 73 ms
71,296 KB
testcase_06 AC 136 ms
116,608 KB
testcase_07 AC 71 ms
71,296 KB
testcase_08 AC 135 ms
116,480 KB
testcase_09 AC 72 ms
71,168 KB
testcase_10 AC 70 ms
70,656 KB
testcase_11 AC 72 ms
71,808 KB
testcase_12 AC 166 ms
116,736 KB
testcase_13 AC 80 ms
71,168 KB
testcase_14 AC 76 ms
71,424 KB
testcase_15 AC 141 ms
116,480 KB
testcase_16 AC 75 ms
71,424 KB
testcase_17 AC 75 ms
71,296 KB
testcase_18 AC 139 ms
116,480 KB
testcase_19 AC 72 ms
71,296 KB
testcase_20 AC 71 ms
71,168 KB
testcase_21 AC 72 ms
70,912 KB
testcase_22 AC 76 ms
71,680 KB
testcase_23 AC 79 ms
71,296 KB
testcase_24 AC 72 ms
71,168 KB
testcase_25 AC 78 ms
71,424 KB
testcase_26 AC 136 ms
116,480 KB
testcase_27 AC 70 ms
70,912 KB
testcase_28 AC 72 ms
71,552 KB
testcase_29 AC 133 ms
116,480 KB
testcase_30 AC 71 ms
71,424 KB
testcase_31 AC 72 ms
71,680 KB
testcase_32 AC 136 ms
116,736 KB
testcase_33 AC 71 ms
71,168 KB
testcase_34 AC 167 ms
116,352 KB
testcase_35 AC 77 ms
71,424 KB
testcase_36 AC 144 ms
116,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, threading

N = int(input())
A_list = list(map(int, input().split()))

basis, comb = [0]*60, [None]*60

for idx, Ai in enumerate(A_list):
    v, cmb = Ai, {idx: 1}
    for k in reversed(range(60)):
        if (v >> k) & 1:
            if not basis[k]:
                basis[k], comb[k] = v, cmb.copy()
                break
            v ^= basis[k]
            for key, val in comb[k].items():
                cmb[key] = (cmb.get(key, 0) + val) % 2
    else:
        ans = sorted(i+1 for i, cnt in cmb.items() if cnt % 2)
        print(len(ans))
        print(' '.join(map(str, ans)))
        exit()

print(-1)

threading.Thread(target=lambda: None).start()
0