結果

問題 No.1863 Xor Sum 2...?
ユーザー AEn
提出日時 2022-09-02 16:31:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 399 bytes
コンパイル時間 899 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 103,368 KB
最終ジャッジ日時 2024-11-15 21:19:52
合計ジャッジ時間 5,058 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
l, r = 0, 0
sm_a = 0
sm_b = 0
res = 0
while l<N:
    while r<N and ((sm_a&A[r]==0 and sm_b^B[r]==0) or (sm_a&A[r]==1 and sm_b^B[r]==1)):
        sm_a ^= A[r]
        sm_b ^= B[r]
        r += 1
    res += r-l
    if r>l:
        sm_a ^= A[l]
        sm_b ^= B[l]
    l += 1
    if l>r:
        r = l
print(res)
0