結果

問題 No.1142 XOR と XOR
ユーザー marroncastlemarroncastle
提出日時 2020-07-31 23:52:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 761 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 110,548 KB
最終ジャッジ日時 2023-09-21 03:33:36
合計ジャッジ時間 6,243 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
76,432 KB
testcase_01 AC 100 ms
76,596 KB
testcase_02 WA -
testcase_03 AC 172 ms
109,556 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 162 ms
110,548 KB
testcase_08 AC 169 ms
107,672 KB
testcase_09 AC 170 ms
107,712 KB
testcase_10 AC 173 ms
107,600 KB
testcase_11 RE -
testcase_12 WA -
testcase_13 RE -
testcase_14 WA -
testcase_15 WA -
testcase_16 RE -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 RE -
testcase_21 WA -
testcase_22 RE -
testcase_23 WA -
testcase_24 RE -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

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]
    now_b ^= B[i]
    cum_a[now_a] += 1
    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