結果

問題 No.1142 XOR と XOR
ユーザー 双六双六
提出日時 2020-07-31 22:36:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,005 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 139,604 KB
最終ジャッジ日時 2023-09-21 01:05:44
合計ジャッジ時間 8,626 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 187 ms
78,004 KB
testcase_01 AC 185 ms
78,160 KB
testcase_02 WA -
testcase_03 AC 280 ms
139,540 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 267 ms
138,464 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 247 ms
121,708 KB
testcase_18 AC 201 ms
84,380 KB
testcase_19 AC 265 ms
128,308 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 207 ms
85,784 KB
testcase_23 AC 255 ms
125,196 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, M, K = getlist()
	A = getlist()
	B = getlist()
	Asum = defaultdict(int)
	Bsum = defaultdict(int)
	val1 = 0
	val2 = 0
	Asum[0] += 1
	Bsum[0] += 1
	for i in range(N):
		val1 ^= A[i]
		Asum[val1] += 1
	for i in range(M):
		val2 ^= B[i]
		Bsum[val2] += 1

	AX = defaultdict(int)
	BX = defaultdict(int)
	for i in range(1024):
		for j in range(i, 1024):
			if i == j:
				AX[0] += int((Asum[i] - 1) * Asum[i] // 2)
			else:
				AX[i ^ j] += Asum[i] * Asum[j]

	for i in range(1024):
		for j in range(i, 1024):
			if i == j:
				BX[0] += int((Bsum[i] - 1) * Bsum[i] // 2)
			else:
				BX[i ^ j] += Bsum[i] * Bsum[j]

	ans = defaultdict(int)
	for i in range(1024):
		for j in range(1024):
			ans[i ^ j] += AX[i] * BX[i]

	print(ans[K] % con)

if __name__ == '__main__':
	main()
0