結果

問題 No.1493 隣接xor
ユーザー googol_S0googol_S0
提出日時 2021-04-30 21:58:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 307 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 87,296 KB
実行使用メモリ 136,608 KB
最終ジャッジ日時 2023-09-26 06:02:09
合計ジャッジ時間 6,431 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,356 KB
testcase_01 AC 73 ms
71,420 KB
testcase_02 AC 74 ms
71,300 KB
testcase_03 AC 192 ms
136,608 KB
testcase_04 AC 181 ms
136,348 KB
testcase_05 AC 181 ms
136,108 KB
testcase_06 AC 182 ms
136,308 KB
testcase_07 AC 181 ms
136,420 KB
testcase_08 AC 184 ms
136,304 KB
testcase_09 AC 184 ms
136,108 KB
testcase_10 AC 182 ms
136,200 KB
testcase_11 AC 182 ms
136,316 KB
testcase_12 AC 182 ms
136,108 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 75 ms
71,288 KB
testcase_16 AC 73 ms
71,176 KB
testcase_17 AC 73 ms
71,560 KB
testcase_18 AC 73 ms
71,148 KB
testcase_19 AC 71 ms
71,308 KB
testcase_20 AC 133 ms
113,996 KB
testcase_21 AC 133 ms
109,052 KB
testcase_22 AC 119 ms
104,292 KB
testcase_23 AC 134 ms
113,984 KB
testcase_24 AC 179 ms
135,968 KB
testcase_25 AC 115 ms
101,328 KB
testcase_26 AC 132 ms
103,416 KB
testcase_27 AC 103 ms
93,012 KB
testcase_28 AC 177 ms
130,104 KB
testcase_29 AC 138 ms
99,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
C=[0]*(N+1)
for i in range(N):
  C[i+1]=C[i]^A[i]
D=dict()
D[0]=0
B=[0]*(N+1)
for i in range(N):
  B[i+1]=D.get(C[i+1],0)
  D[C[i+1]]=i+1
mod=10**9+7
DP=[0]*(N+2)
DP[1]=1
for i in range(N):
  DP[i+2]=(DP[i+1]+DP[i+1]-DP[B[i+1]])%mod
print((DP[N+1]-DP[N])%mod)
0