結果

問題 No.1863 Xor Sum 2...?
ユーザー irumo8202
提出日時 2022-03-04 22:18:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 333 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 103,296 KB
最終ジャッジ日時 2024-07-18 20:48:54
合計ジャッジ時間 3,189 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


ans = int(B[0] == 0)
for i in range(1, N):
    if B[i] == 1:
        continue
    tot = A[i]
    xor = A[i]
    j = i - 1
    while tot - xor == 0 and j >= 0:
        ans += 1
        tot += A[j]
        xor ^= A[j]
        j -= 1

print(ans)
0