結果
| 問題 |
No.1493 隣接xor
|
| コンテスト | |
| ユーザー |
Kiri8128
|
| 提出日時 | 2021-05-01 01:00:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 189 ms / 2,000 ms |
| コード長 | 333 bytes |
| コンパイル時間 | 175 ms |
| コンパイル使用メモリ | 82,560 KB |
| 実行使用メモリ | 161,772 KB |
| 最終ジャッジ日時 | 2024-07-19 04:54:22 |
| 合計ジャッジ時間 | 5,358 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
from collections import defaultdict
P = 10 ** 9 + 7
N = int(input())
A = [int(a) for a in input().split()]
B = []
s = 0
for a in A[:-1]:
s ^= a
B.append(s)
X = [1]
Y = [0, 1]
D = defaultdict(int)
for i, b in enumerate(B, 1):
a = (Y[i] - Y[D[b]]) % P
X.append(a)
Y.append((Y[-1] + a) % P)
D[b] = i
print(Y[-1])
Kiri8128