結果

問題 No.2895 Zero XOR Subset
ユーザー titiatitia
提出日時 2024-09-20 22:25:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 563 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 33,852 KB
最終ジャッジ日時 2024-09-20 22:26:04
合計ジャッジ時間 7,611 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,496 KB
testcase_01 AC 28 ms
10,496 KB
testcase_02 RE -
testcase_03 AC 27 ms
10,496 KB
testcase_04 AC 29 ms
10,496 KB
testcase_05 AC 28 ms
10,624 KB
testcase_06 RE -
testcase_07 AC 29 ms
10,496 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 30 ms
10,496 KB
testcase_11 AC 27 ms
10,496 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 30 ms
10,496 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 28 ms
10,624 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 30 ms
10,624 KB
testcase_21 AC 28 ms
10,624 KB
testcase_22 RE -
testcase_23 AC 28 ms
10,496 KB
testcase_24 AC 28 ms
10,496 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 30 ms
10,752 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 28 ms
10,496 KB
testcase_36 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

# xorの掃き出し法・基底

BASE=[]

def sweep(x):
    LIST=[]
    for b,ind in BASE:
        if b^x<x:
            x=b^x
            LIST.append(ind)
    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]

        print(len(ANS))
        for ans in ANS:
            print(ans+1)

        break
else:
    print(-1)
0