結果
| 問題 | 
                            No.1493 隣接xor
                             | 
                    
| コンテスト | |
| ユーザー | 
                             gew1fw
                         | 
                    
| 提出日時 | 2025-06-12 14:11:47 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 535 bytes | 
| コンパイル時間 | 195 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 132,444 KB | 
| 最終ジャッジ日時 | 2025-06-12 14:12:29 | 
| 合計ジャッジ時間 | 5,288 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 25 WA * 2 | 
ソースコード
MOD = 10**9 + 7
n = int(input())
A = list(map(int, input().split()))
prefix = [0] * (n + 1)
for i in range(n):
    prefix[i+1] = prefix[i] ^ A[i]
target = prefix[n]
from collections import defaultdict
last = defaultdict(int)
last[0] = 1  # Initial state: the subsequence [0]
total = 1     # Sum of all values in 'last', initially 1
for i in range(1, n + 1):
    s = prefix[i]
    new_count = (total - last[s]) % MOD
    total = (total + new_count) % MOD
    last[s] = (last[s] + new_count) % MOD
print(last.get(target, 0) % MOD)
            
            
            
        
            
gew1fw