結果

問題 No.1142 XOR と XOR
ユーザー xuanjixuanji
提出日時 2020-07-31 23:14:43
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 784 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 130,720 KB
最終ジャッジ日時 2023-09-21 02:38:17
合計ジャッジ時間 5,057 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
76,240 KB
testcase_01 AC 92 ms
71,660 KB
testcase_02 AC 93 ms
71,320 KB
testcase_03 AC 253 ms
129,956 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env pypy3

from collections import defaultdict, Counter

import sys
from sys import stdin, stdout
 
def input():
    return stdin.readline().strip()

MODULUS = 1000000007

N, M, K = input().split()

K = int(K)

A = list(map(int, input().split()))
B = list(map(int, input().split()))

def prefix(N):
    ret = [0]
    for n in N:
        ret += [ret[-1] ^ n]
    return ret

A = prefix(A)
B = prefix(B)

cA = Counter()
cB = Counter()

fA = defaultdict(int)
fB = defaultdict(int)

# print(A)

for a in A: # O(2*10**5)
    for k in cA: # O(1024)
        fA[a^k] += cA[k]
    cA[a] += 1

for b in B: # O(2*10**6)
    for k in cB: # O(1024)
        fB[b^k] += cB[k]
    cB[b] += 1

ans = 0

for i in range(1025):
    j = i^K
    ans += fA[i]*fB[j]
    ans %= MODULUS

print(ans)
0