結果

問題 No.1142 XOR と XOR
ユーザー qumazakiqumazaki
提出日時 2020-09-08 18:47:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 726 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 114,836 KB
最終ジャッジ日時 2024-04-25 16:43:01
合計ジャッジ時間 3,997 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
62,860 KB
testcase_01 AC 62 ms
63,700 KB
testcase_02 AC 60 ms
62,908 KB
testcase_03 AC 133 ms
108,300 KB
testcase_04 AC 110 ms
110,424 KB
testcase_05 AC 111 ms
107,620 KB
testcase_06 AC 122 ms
109,028 KB
testcase_07 AC 123 ms
114,836 KB
testcase_08 AC 127 ms
108,916 KB
testcase_09 AC 125 ms
108,912 KB
testcase_10 AC 124 ms
108,640 KB
testcase_11 AC 56 ms
62,804 KB
testcase_12 AC 58 ms
62,776 KB
testcase_13 AC 57 ms
62,888 KB
testcase_14 AC 99 ms
103,748 KB
testcase_15 AC 99 ms
105,256 KB
testcase_16 AC 63 ms
67,620 KB
testcase_17 AC 107 ms
110,428 KB
testcase_18 AC 68 ms
77,384 KB
testcase_19 AC 116 ms
110,680 KB
testcase_20 AC 98 ms
103,764 KB
testcase_21 AC 80 ms
89,552 KB
testcase_22 AC 69 ms
79,432 KB
testcase_23 AC 113 ms
109,956 KB
testcase_24 AC 117 ms
110,476 KB
testcase_25 AC 96 ms
102,044 KB
testcase_26 AC 118 ms
108,044 KB
testcase_27 AC 111 ms
105,884 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

ax = [0]*1024
bx = [0]*1024
for xx,x in zip([ax,bx],[a,b]):
    tmp = 0
    # xx[0] += 1
    for xi in x:
        tmp = tmp^xi
        xx[tmp] += 1

ax2 = [ ai*2 for ai in ax]
bx2 = [ bi*2 for bi in bx]
for xx,xx2 in zip([ax,bx],[ax2,bx2]):
    for i in range(1024):
        for j in range(1024):
            if(i==j):
                xx2[0] += (xx[i]*(xx[i]-1))
                xx2[0] %= mod
            else:
                xx2[i ^ j] += xx[i]*xx[j]
                xx2[i ^ j] %= mod

ans = 0
for i in range(1024):
    ans += ax2[i] * bx2[k^i]
    ans %= mod
ans *= pow(4,mod-2,mod)
ans %= mod

print(ans)
0