結果

問題 No.1142 XOR と XOR
ユーザー tyawanmusityawanmusi
提出日時 2020-06-27 16:17:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 601 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 10,900 KB
実行使用メモリ 38,044 KB
最終ジャッジ日時 2023-08-07 21:55:29
合計ジャッジ時間 14,948 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 321 ms
8,244 KB
testcase_01 AC 283 ms
8,300 KB
testcase_02 AC 306 ms
8,292 KB
testcase_03 AC 565 ms
38,044 KB
testcase_04 AC 535 ms
28,048 KB
testcase_05 AC 492 ms
24,592 KB
testcase_06 AC 568 ms
30,220 KB
testcase_07 AC 508 ms
14,060 KB
testcase_08 AC 601 ms
35,368 KB
testcase_09 AC 565 ms
35,540 KB
testcase_10 AC 569 ms
35,520 KB
testcase_11 AC 279 ms
8,188 KB
testcase_12 AC 302 ms
8,192 KB
testcase_13 AC 322 ms
8,288 KB
testcase_14 AC 484 ms
26,980 KB
testcase_15 AC 474 ms
24,784 KB
testcase_16 AC 359 ms
9,488 KB
testcase_17 AC 458 ms
11,948 KB
testcase_18 AC 357 ms
9,208 KB
testcase_19 AC 522 ms
31,180 KB
testcase_20 AC 472 ms
25,072 KB
testcase_21 AC 448 ms
20,816 KB
testcase_22 AC 404 ms
13,156 KB
testcase_23 AC 530 ms
29,852 KB
testcase_24 AC 570 ms
31,152 KB
testcase_25 AC 430 ms
22,052 KB
testcase_26 AC 483 ms
35,316 KB
testcase_27 AC 460 ms
23,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
for i in range(1,n):a[i]^=a[i-1]
for j in range(1,m):b[j]^=b[j-1]
a1=[0]*1024
b1=[0]*1024
a2=[0]*1024
b2=[0]*1024
for x in a:a1[x]+=1
for y in b:b1[y]+=1
for i in range(1024):
  for j in range(i,1024):
    if i==j:
      a2[i^j]+=a1[i]*(a1[j]-1)//2
      b2[i^j]+=b1[i]*(b1[j]-1)//2
    else:
      a2[i^j]+=a1[i]*a1[j]
      b2[i^j]+=b1[i]*b1[j]
ans=0
for i in range(1024):
  j=k^i
  ans+=(a1[i]+a2[i])*(b1[j]+b2[j])
  ans%=10**9+7
print(ans)
0