結果
| 問題 |
No.1142 XOR と XOR
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-31 23:52:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 761 bytes |
| コンパイル時間 | 157 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 114,560 KB |
| 最終ジャッジ日時 | 2024-07-06 22:12:40 |
| 合計ジャッジ時間 | 4,118 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 5 WA * 11 RE * 9 |
ソースコード
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())