結果

問題 No.2895 Zero XOR Subset
ユーザー C++
提出日時 2024-09-20 21:38:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 590 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 129,564 KB
最終ジャッジ日時 2024-09-20 21:38:23
合計ジャッジ時間 8,114 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import os, sys
if os.path.exists("input.txt"):
  sys.stdin = open('input.txt', 'r')
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def inp(): return readline().rstrip().decode('utf-8')
def inps(): return map(int, inp().split())

inp()
B = list(inps())
if 0 in B:
  print(1)
  print(B.index(0) + 1)
  exit()

di = {}
di.setdefault(0, 0)
xr = 0
for i, v in enumerate(B):
  xr ^= v
  if xr in di:
    print(i - di[xr] + 1)
    for j in range(di[xr], i + 1):
      print(j + 1, end = ' ')
    print()
    exit()
  di[xr] = i

print(-1)
0