結果

問題 No.1863 Xor Sum 2...?
ユーザー hir355
提出日時 2022-03-04 22:12:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 350 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 102,784 KB
最終ジャッジ日時 2024-07-18 20:42:54
合計ジャッジ時間 3,781 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
r = 0
ans = 0
bx = 0
sx = 0
ax = 0
for l in range(n):
    while r < n and bx ^ b[r] == 0 and sx + a[r] == ax ^ a[r]:
        bx ^= b[r]
        sx += a[r]
        ax ^= a[r]
        r += 1
    ans += r - l
    bx ^= b[l]
    sx -= a[l]
    ax ^= a[l]
print(ans)
0