結果

問題 No.1142 XOR と XOR
ユーザー mkawa2mkawa2
提出日時 2021-05-28 17:08:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 1,252 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 82,404 KB
実行使用メモリ 121,076 KB
最終ジャッジ日時 2024-04-25 16:49:47
合計ジャッジ時間 3,775 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
61,860 KB
testcase_01 AC 48 ms
62,720 KB
testcase_02 AC 53 ms
62,336 KB
testcase_03 AC 110 ms
118,000 KB
testcase_04 AC 101 ms
116,392 KB
testcase_05 AC 96 ms
111,576 KB
testcase_06 AC 103 ms
118,552 KB
testcase_07 AC 107 ms
120,320 KB
testcase_08 AC 109 ms
118,928 KB
testcase_09 AC 109 ms
119,304 KB
testcase_10 AC 108 ms
119,340 KB
testcase_11 AC 50 ms
62,844 KB
testcase_12 AC 49 ms
62,992 KB
testcase_13 AC 51 ms
62,436 KB
testcase_14 AC 83 ms
100,896 KB
testcase_15 AC 82 ms
102,072 KB
testcase_16 AC 53 ms
66,072 KB
testcase_17 AC 98 ms
116,120 KB
testcase_18 AC 60 ms
74,560 KB
testcase_19 AC 104 ms
121,076 KB
testcase_20 AC 84 ms
100,808 KB
testcase_21 AC 69 ms
86,308 KB
testcase_22 AC 60 ms
77,292 KB
testcase_23 AC 103 ms
118,860 KB
testcase_24 AC 108 ms
117,552 KB
testcase_25 AC 80 ms
98,728 KB
testcase_26 AC 103 ms
119,828 KB
testcase_27 AC 94 ms
111,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
dij = [(0, 1), (1, 0), (1, 1), (1, -1)]
inf = 10**16
# md = 998244353
md = 10**9+7

def CNT(aa):
    cnt = [0]*(1 << 10)
    cnt[0] = 1
    s = 0
    for a in aa:
        s ^= a
        cnt[s] += 1
    cntlr = [0]*(1 << 10)
    for i in range(1 << 10):
        cntlr[0] += cnt[i]*(cnt[i]-1)//2
        cntlr[0] %= md
        for j in range(i):
            cntlr[i ^ j] += cnt[i]*cnt[j]
            cntlr[i ^ j] %= md
    return cntlr

n, m, k = LI()
aa = LI()
bb = LI()

cnt1 = CNT(aa)
cnt2 = CNT(bb)
ans = 0
for i in range(1 << 10):
    ans += cnt1[i]*cnt2[i ^ k]
    ans%=md

print(ans)
0