結果

問題 No.1863 Xor Sum 2...?
ユーザー AEnAEn
提出日時 2022-09-02 16:31:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 399 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 81,764 KB
実行使用メモリ 102,956 KB
最終ジャッジ日時 2024-04-27 17:17:06
合計ジャッジ時間 4,180 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
52,688 KB
testcase_01 AC 34 ms
53,384 KB
testcase_02 AC 37 ms
53,420 KB
testcase_03 AC 40 ms
53,732 KB
testcase_04 AC 36 ms
53,544 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 61 ms
78,656 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 77 ms
96,356 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 45 ms
68,044 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 87 ms
102,200 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 87 ms
102,580 KB
権限があれば一括ダウンロードができます

ソースコード

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