結果

問題 No.2895 Zero XOR Subset
ユーザー mkawa2mkawa2
提出日時 2024-09-20 21:55:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 1,230 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 33,176 KB
最終ジャッジ日時 2024-09-20 21:55:49
合計ジャッジ時間 4,053 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
10,752 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 99 ms
33,176 KB
testcase_03 AC 25 ms
10,880 KB
testcase_04 AC 25 ms
10,752 KB
testcase_05 AC 25 ms
10,752 KB
testcase_06 AC 97 ms
32,916 KB
testcase_07 AC 26 ms
10,752 KB
testcase_08 AC 100 ms
32,920 KB
testcase_09 AC 26 ms
10,880 KB
testcase_10 AC 33 ms
10,752 KB
testcase_11 AC 25 ms
10,752 KB
testcase_12 AC 99 ms
33,176 KB
testcase_13 AC 26 ms
10,752 KB
testcase_14 AC 26 ms
10,752 KB
testcase_15 AC 119 ms
33,176 KB
testcase_16 AC 26 ms
10,752 KB
testcase_17 AC 24 ms
10,752 KB
testcase_18 AC 96 ms
33,048 KB
testcase_19 AC 25 ms
10,752 KB
testcase_20 AC 25 ms
10,880 KB
testcase_21 AC 25 ms
10,752 KB
testcase_22 AC 26 ms
10,752 KB
testcase_23 AC 25 ms
10,624 KB
testcase_24 AC 25 ms
10,752 KB
testcase_25 AC 25 ms
10,880 KB
testcase_26 AC 97 ms
32,956 KB
testcase_27 AC 33 ms
10,880 KB
testcase_28 AC 25 ms
10,624 KB
testcase_29 AC 98 ms
32,916 KB
testcase_30 AC 25 ms
10,752 KB
testcase_31 AC 25 ms
10,752 KB
testcase_32 AC 119 ms
32,916 KB
testcase_33 AC 26 ms
10,752 KB
testcase_34 AC 98 ms
33,172 KB
testcase_35 AC 27 ms
10,752 KB
testcase_36 AC 97 ms
33,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = -1-(-1 << 31)
inf = -1-(-1 << 62)

# md = 10**9+7
md = 998244353

n=II()
aa=LI()

base=[-1]*60
ss=[0]*60
for i,a in enumerate(aa):
    now=1<<i
    while a:
        k=a.bit_length()-1
        if base[k]==-1:
            base[k]=a
            ss[k]=now
            break
        else:
            a^=base[k]
            now^=ss[k]
    if a==0:
        k=1
        ans=[]
        while now:
            if now&1:ans.append(k)
            k+=1
            now>>=1
        print(len(ans))
        print(*ans)
        exit()

print(-1)
0