結果
問題 | No.1863 Xor Sum 2...? |
ユーザー | rin204 |
提出日時 | 2022-03-20 14:54:45 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 596 bytes |
コンパイル時間 | 285 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 103,424 KB |
最終ジャッジ日時 | 2024-04-16 07:40:32 |
合計ジャッジ時間 | 3,920 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
52,096 KB |
testcase_01 | AC | 38 ms
52,096 KB |
testcase_02 | AC | 39 ms
51,584 KB |
testcase_03 | AC | 38 ms
52,096 KB |
testcase_04 | AC | 38 ms
51,712 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 85 ms
91,392 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 86 ms
91,136 KB |
testcase_16 | WA | - |
testcase_17 | AC | 77 ms
86,864 KB |
testcase_18 | WA | - |
testcase_19 | AC | 72 ms
83,072 KB |
testcase_20 | AC | 86 ms
93,824 KB |
testcase_21 | WA | - |
testcase_22 | AC | 73 ms
80,896 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 116 ms
103,044 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | AC | 106 ms
102,912 KB |
ソースコード
""" A_l + ... + A_r が二進数で繰り上がりなし B_l ^ ... ^ B_r が0 ならOK """ n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) z = 1 o = 0 tot = 0 Z = [1] O = [0] zo = [0] for b in B: tot ^= b if tot == 0: z += 1 else: o += 1 Z.append(z) O.append(o) zo.append(tot) ans = B.count(0) bit = 0 l = 0 for r, a in enumerate(A, 1): while bit & a != 0: bit ^= A[l] l += 1 bit ^= a if zo[r] == 0: ans += Z[r] - Z[l] - 1 else: ans += O[r] - O[l] - 1 print(ans)