結果

問題 No.1863 Xor Sum 2...?
ユーザー ああいいああいい
提出日時 2022-03-04 21:35:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 101,332 KB
最終ジャッジ日時 2023-09-26 00:14:02
合計ジャッジ時間 4,740 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,248 KB
testcase_01 AC 69 ms
71,328 KB
testcase_02 AC 67 ms
71,472 KB
testcase_03 AC 68 ms
71,548 KB
testcase_04 AC 68 ms
71,276 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
sumb = [0] * N
sumb[0] = B[0]
for i in range(1,N):
    sumb[i] = sumb[i-1] ^ B[i]
C = [0] * (N + 1)
for i in range(1,N+1):
    C[i] = C[i-1]
    if sumb[i-1] == 0:
        C[i] += 1
ans = 0
right = 0
now = 0
for left in range(N):
    while right < N and now + A[right] == now ^ A[right]:
        now += A[right]
        right += 1
    ans += C[right] - C[left]
    now -= A[left]
print(ans)
0