結果

問題 No.1142 XOR と XOR
ユーザー tktk_snsntktk_snsn
提出日時 2020-11-29 23:47:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 852 ms / 2,000 ms
コード長 645 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 37,612 KB
最終ジャッジ日時 2024-04-25 16:44:37
合計ジャッジ時間 20,723 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 676 ms
10,880 KB
testcase_01 AC 676 ms
10,752 KB
testcase_02 AC 680 ms
10,752 KB
testcase_03 AC 852 ms
37,612 KB
testcase_04 AC 631 ms
28,188 KB
testcase_05 AC 603 ms
25,612 KB
testcase_06 AC 631 ms
30,448 KB
testcase_07 AC 788 ms
16,568 KB
testcase_08 AC 661 ms
34,964 KB
testcase_09 AC 666 ms
34,860 KB
testcase_10 AC 662 ms
34,848 KB
testcase_11 AC 672 ms
10,752 KB
testcase_12 AC 675 ms
10,752 KB
testcase_13 AC 678 ms
10,752 KB
testcase_14 AC 698 ms
27,668 KB
testcase_15 AC 673 ms
25,004 KB
testcase_16 AC 588 ms
12,032 KB
testcase_17 AC 752 ms
15,560 KB
testcase_18 AC 685 ms
12,032 KB
testcase_19 AC 642 ms
31,092 KB
testcase_20 AC 593 ms
25,952 KB
testcase_21 AC 541 ms
21,740 KB
testcase_22 AC 526 ms
14,936 KB
testcase_23 AC 621 ms
29,744 KB
testcase_24 AC 650 ms
31,308 KB
testcase_25 AC 746 ms
21,464 KB
testcase_26 AC 803 ms
33,992 KB
testcase_27 AC 762 ms
22,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
from collections import Counter
from operator import xor
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
mod = 10 ** 9 + 7


def make_cnt(A):
    Axor = list(accumulate(A, func=xor, initial=0))
    C = Counter(Axor)
    cnt = [0] * 1024
    for i in range(1024):
        cnt[0] += C[i] * (C[i] - 1) // 2
        for j in range(i + 1, 1024):
            cnt[i ^ j] += C[i] * C[j]
            cnt[i ^ j] %= mod
    return cnt


Acnt = make_cnt(A)
Bcnt = make_cnt(B)
ans = 0
for i in range(1024):
    ans += Acnt[i] * Bcnt[k ^ i]
    ans %= mod
print(ans)
0