結果
| 問題 |
No.1142 XOR と XOR
|
| ユーザー |
|
| 提出日時 | 2020-11-18 19:02:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 144 ms / 2,000 ms |
| コード長 | 688 bytes |
| コンパイル時間 | 261 ms |
| コンパイル使用メモリ | 82,156 KB |
| 実行使用メモリ | 113,536 KB |
| 最終ジャッジ日時 | 2024-11-08 03:49:39 |
| 合計ジャッジ時間 | 4,480 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
import sys
input = sys.stdin.readline
N, M, K = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
now = 0
cnt = [0]*1024
cnt[0] = 1
for ai in a:
now ^= ai
cnt[now] += 1
cnt2 = [0]*1024
for i in range(1024):
for j in range(i):
cnt2[i^j] += cnt[i]*cnt[j]
cnt2[0] += cnt[i]*(cnt[i]-1)//2
now = 0
cnt3 = [0]*1024
cnt3[0] = 1
for bi in b:
now ^= bi
cnt3[now] += 1
cnt4 = [0]*1024
for i in range(1024):
for j in range(i):
cnt4[i^j] += cnt3[i]*cnt3[j]
cnt4[0] += cnt3[i]*(cnt3[i]-1)//2
ans = 0
MOD = 10**9+7
for i in range(1024):
ans = (ans+cnt2[i]*cnt4[i^K])%MOD
print(ans)