結果

問題 No.1142 XOR と XOR
ユーザー None
提出日時 2021-02-27 18:17:04
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 573 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 82,784 KB
実行使用メモリ 110,872 KB
最終ジャッジ日時 2024-10-02 18:01:24
合計ジャッジ時間 4,495 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 TLE * 1 -- * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(A):
    a0=0
    P=defaultdict(int)
    AA=defaultdict(int)
    for a in A:
        a0^=a
        for p,val in P.items():
            AA[a0^p]+=val
            AA[a0^p]%=MOD
        P[a0]+=1
        AA[a0]+=1
    return AA

import sys
input = sys.stdin.readline
from  collections import defaultdict
MOD=10**9+7
N,M,K=map(int, input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))

A=f(A)
B=f(B)
cnt=0
for a,val_a in A.items():
    for b,val_b in B.items():
        if a^b==K:
            cnt+=val_a*val_b
            cnt%=MOD
print(cnt)
0