結果

問題 No.1142 XOR と XOR
ユーザー brthyyjpbrthyyjp
提出日時 2022-02-08 13:48:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 639 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 82,556 KB
実行使用メモリ 115,096 KB
最終ジャッジ日時 2024-04-25 16:50:27
合計ジャッジ時間 4,145 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
62,896 KB
testcase_01 AC 54 ms
62,524 KB
testcase_02 AC 56 ms
63,440 KB
testcase_03 AC 129 ms
108,184 KB
testcase_04 AC 112 ms
110,016 KB
testcase_05 AC 105 ms
107,860 KB
testcase_06 AC 116 ms
108,620 KB
testcase_07 AC 122 ms
115,096 KB
testcase_08 AC 127 ms
108,680 KB
testcase_09 AC 128 ms
108,644 KB
testcase_10 AC 124 ms
108,752 KB
testcase_11 AC 55 ms
63,532 KB
testcase_12 AC 55 ms
63,256 KB
testcase_13 AC 55 ms
62,480 KB
testcase_14 AC 98 ms
104,056 KB
testcase_15 AC 98 ms
105,700 KB
testcase_16 AC 58 ms
67,852 KB
testcase_17 AC 109 ms
110,016 KB
testcase_18 AC 66 ms
77,244 KB
testcase_19 AC 118 ms
110,980 KB
testcase_20 AC 98 ms
103,792 KB
testcase_21 AC 77 ms
88,980 KB
testcase_22 AC 67 ms
79,000 KB
testcase_23 AC 112 ms
110,132 KB
testcase_24 AC 117 ms
110,408 KB
testcase_25 AC 95 ms
101,828 KB
testcase_26 AC 115 ms
107,768 KB
testcase_27 AC 108 ms
105,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

mod = 10**9+7

def func(A):
    n = len(A)
    cnt = [0]*(1<<10)
    total = 0
    cnt[0] = 1
    for a in A:
        total ^= a
        cnt[total] += 1
    res = [0]*(1<<10)
    for i in range(1<<10):
        for j in range(i+1, 1<<10):
            res[i^j] += cnt[i]*cnt[j]
    for i in range(1<<10):
        res[i^i] += cnt[i]*(cnt[i]-1)//2
    return res

CA = func(A)
CB = func(B)
ans = 0
for a in range(1<<10):
    for b in range(1<<10):
        if a^b == k:
            ans += CA[a]*CB[b]
            ans %= mod
print(ans)
0