結果

問題 No.1493 隣接xor
コンテスト
ユーザー 👑 rin204
提出日時 2025-02-16 22:01:41
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 96 ms / 2,000 ms
+ 938µs
コード長 259 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 83 ms
コンパイル使用メモリ 64,796 KB
実行使用メモリ 97,896 KB
最終ジャッジ日時 2026-10-16 23:48:05
合計ジャッジ時間 6,099 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

MOD = 10**9 + 7

n = int(input())
A = list(map(int, input().split()))
B = []
x = 0
for a in A:
    x ^= a
    B.append(x)
B.pop()

tot = 1
cnt = {-1: 1}
for b in B:
    nex = tot
    tot = nex + tot - cnt.get(b, 0)
    tot %= MOD
    cnt[b] = nex

print(tot)
0