結果
問題 |
No.1493 隣接xor
|
ユーザー |
|
提出日時 | 2021-05-01 00:35:24 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 160 ms / 2,000 ms |
コード長 | 456 bytes |
コンパイル時間 | 1,039 ms |
コンパイル使用メモリ | 82,168 KB |
実行使用メモリ | 145,804 KB |
最終ジャッジ日時 | 2024-07-19 04:36:47 |
合計ジャッジ時間 | 4,777 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") n = int(input()) a = list(map(int, input().split())) from collections import defaultdict d = defaultdict(int) M = 10**9+7 c = [0] for v in a: c.append(c[-1]^v) d[-1] = 1 s = 1 ans = 1 for v in c[1:-1]: val = s s += (val - d[v]) s %= M d[v] = val print(s%M)