結果

問題 No.1142 XOR と XOR
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-03-07 23:54:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 706 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 82,580 KB
実行使用メモリ 114,736 KB
最終ジャッジ日時 2024-04-25 16:50:35
合計ジャッジ時間 3,987 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
61,528 KB
testcase_01 AC 48 ms
61,956 KB
testcase_02 AC 52 ms
62,224 KB
testcase_03 AC 116 ms
107,684 KB
testcase_04 AC 102 ms
110,104 KB
testcase_05 AC 97 ms
107,740 KB
testcase_06 AC 106 ms
108,860 KB
testcase_07 AC 112 ms
114,736 KB
testcase_08 AC 117 ms
108,848 KB
testcase_09 AC 118 ms
109,016 KB
testcase_10 AC 115 ms
108,872 KB
testcase_11 AC 49 ms
63,268 KB
testcase_12 AC 49 ms
62,080 KB
testcase_13 AC 49 ms
61,336 KB
testcase_14 AC 91 ms
103,772 KB
testcase_15 AC 92 ms
105,264 KB
testcase_16 AC 53 ms
66,672 KB
testcase_17 AC 100 ms
110,064 KB
testcase_18 AC 60 ms
75,900 KB
testcase_19 AC 108 ms
110,924 KB
testcase_20 AC 90 ms
103,672 KB
testcase_21 AC 72 ms
90,272 KB
testcase_22 AC 62 ms
79,104 KB
testcase_23 AC 108 ms
109,928 KB
testcase_24 AC 112 ms
110,432 KB
testcase_25 AC 87 ms
102,056 KB
testcase_26 AC 104 ms
107,816 KB
testcase_27 AC 99 ms
105,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
M = 1<<10
mod = 10**9+7
ca = [0]*M
cb = [0]*M
ca[0] += 1
cb[0] += 1
num = 0
for a in A:
    num ^= a
    ca[num] += 1
num = 0
for b in B:
    num ^= b
    cb[num] += 1

sA,sB = [0]*M,[0]*M
for i in range(M):
    for j in range(i+1):
        if i == j:
            sA[0] += ca[i]*(ca[i]-1)//2
            sA[0] %= mod
            sB[0] += cb[i]*(cb[i]-1)//2
            sB[0] %= mod
        else:
            sA[i^j] += ca[i]*ca[j]
            sA[i^j] %= mod
            sB[i^j] += cb[i]*cb[j]
            sB[i^j] %= mod


ans = 0
for i in range(M):
    ans += sA[i]*sB[k^i]%mod
    ans %= mod
print(ans)
0