結果

問題 No.1142 XOR と XOR
ユーザー tyawanmusityawanmusi
提出日時 2020-06-27 16:17:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 612 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 37,472 KB
最終ジャッジ日時 2024-04-25 16:12:09
合計ジャッジ時間 14,229 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 292 ms
10,752 KB
testcase_01 AC 290 ms
10,752 KB
testcase_02 AC 286 ms
10,880 KB
testcase_03 AC 564 ms
37,472 KB
testcase_04 AC 565 ms
28,252 KB
testcase_05 AC 521 ms
25,544 KB
testcase_06 AC 564 ms
30,352 KB
testcase_07 AC 489 ms
16,628 KB
testcase_08 AC 612 ms
34,844 KB
testcase_09 AC 595 ms
34,852 KB
testcase_10 AC 599 ms
34,860 KB
testcase_11 AC 289 ms
10,752 KB
testcase_12 AC 290 ms
10,752 KB
testcase_13 AC 291 ms
10,752 KB
testcase_14 AC 472 ms
27,164 KB
testcase_15 AC 486 ms
25,536 KB
testcase_16 AC 335 ms
11,904 KB
testcase_17 AC 439 ms
15,612 KB
testcase_18 AC 323 ms
12,028 KB
testcase_19 AC 569 ms
31,136 KB
testcase_20 AC 504 ms
25,836 KB
testcase_21 AC 436 ms
21,624 KB
testcase_22 AC 404 ms
14,972 KB
testcase_23 AC 552 ms
29,880 KB
testcase_24 AC 595 ms
31,196 KB
testcase_25 AC 403 ms
21,476 KB
testcase_26 AC 493 ms
34,004 KB
testcase_27 AC 445 ms
23,140 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