結果

問題 No.1142 XOR と XOR
ユーザー marroncastlemarroncastle
提出日時 2020-07-31 23:55:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 782 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 82,172 KB
実行使用メモリ 114,732 KB
最終ジャッジ日時 2024-04-25 16:31:28
合計ジャッジ時間 4,291 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
61,708 KB
testcase_01 AC 61 ms
61,600 KB
testcase_02 AC 66 ms
61,932 KB
testcase_03 AC 134 ms
107,948 KB
testcase_04 AC 119 ms
110,128 KB
testcase_05 AC 114 ms
107,756 KB
testcase_06 AC 124 ms
108,872 KB
testcase_07 AC 125 ms
114,732 KB
testcase_08 AC 134 ms
108,808 KB
testcase_09 AC 131 ms
108,820 KB
testcase_10 AC 132 ms
108,980 KB
testcase_11 AC 62 ms
60,980 KB
testcase_12 AC 61 ms
61,996 KB
testcase_13 AC 65 ms
61,144 KB
testcase_14 AC 104 ms
103,652 KB
testcase_15 AC 105 ms
105,236 KB
testcase_16 AC 69 ms
66,260 KB
testcase_17 AC 117 ms
110,244 KB
testcase_18 AC 74 ms
75,308 KB
testcase_19 AC 123 ms
109,672 KB
testcase_20 AC 104 ms
103,568 KB
testcase_21 AC 85 ms
88,660 KB
testcase_22 AC 75 ms
77,484 KB
testcase_23 AC 121 ms
109,860 KB
testcase_24 AC 126 ms
110,420 KB
testcase_25 AC 100 ms
102,056 KB
testcase_26 AC 122 ms
107,784 KB
testcase_27 AC 113 ms
106,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
  mod = 10**9+7
  N, M, K = map(int, input().split())
  A = list(map(int, input().split()))
  B = list(map(int, input().split()))
  cum_a,cum_b = [0]*(1<<10),[0]*(1<<10)
  cum_a[0],cum_b[0] = 1,1
  now_a,now_b = 0,0
  for i in range(N):
    now_a ^= A[i]
    cum_a[now_a] += 1
  for j in range(M):
    now_b ^= B[j]
    cum_b[now_b] += 1
  a2,b2 = [0]*(1<<10),[0]*(1<<10)
  for i in range(1<<10):
    for j in range(i,1<<10):
      if i==j:
        a2[i^j] += cum_a[i]*(cum_a[i]-1)//2
        b2[i^j] += cum_b[i]*(cum_b[i]-1)//2
      else:
        a2[i^j] += cum_a[i]*cum_a[j]
        b2[i^j] += cum_b[i]*cum_b[j]
      a2[i^j] %= mod
      b2[i^j] %= mod
  ans = 0
  for i in range(1<<10):
    j = K^i
    ans += a2[i]*b2[j]
    ans %= mod
  return ans
print(solve())
0