結果
| 問題 | No.1493 隣接xor |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-16 22:01:41 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 105 ms / 2,000 ms |
| コード長 | 259 bytes |
| 記録 | |
| コンパイル時間 | 228 ms |
| コンパイル使用メモリ | 84,992 KB |
| 実行使用メモリ | 143,872 KB |
| 最終ジャッジ日時 | 2026-07-02 10:45:52 |
| 合計ジャッジ時間 | 3,586 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
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)