結果

問題 No.1142 XOR と XOR
ユーザー rlangevinrlangevin
提出日時 2023-11-20 12:18:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,711 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 114,472 KB
最終ジャッジ日時 2023-11-20 12:19:26
合計ジャッジ時間 27,726 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
59,264 KB
testcase_01 AC 40 ms
59,264 KB
testcase_02 AC 39 ms
59,264 KB
testcase_03 AC 1,695 ms
111,432 KB
testcase_04 AC 1,367 ms
109,944 KB
testcase_05 AC 1,112 ms
111,720 KB
testcase_06 AC 1,387 ms
108,496 KB
testcase_07 AC 1,707 ms
114,472 KB
testcase_08 AC 1,687 ms
109,804 KB
testcase_09 AC 1,687 ms
109,792 KB
testcase_10 AC 1,711 ms
109,784 KB
testcase_11 AC 40 ms
59,264 KB
testcase_12 AC 39 ms
59,264 KB
testcase_13 AC 40 ms
59,264 KB
testcase_14 AC 927 ms
103,304 KB
testcase_15 AC 885 ms
104,672 KB
testcase_16 AC 134 ms
66,200 KB
testcase_17 AC 1,283 ms
109,788 KB
testcase_18 AC 309 ms
79,072 KB
testcase_19 AC 1,379 ms
110,744 KB
testcase_20 AC 913 ms
103,216 KB
testcase_21 AC 563 ms
90,660 KB
testcase_22 AC 333 ms
81,816 KB
testcase_23 AC 1,307 ms
109,832 KB
testcase_24 AC 1,459 ms
110,220 KB
testcase_25 AC 843 ms
101,612 KB
testcase_26 AC 1,378 ms
107,724 KB
testcase_27 AC 1,090 ms
111,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N2 = 1 << 10
def f(X):
    ans = [0] * N2
    pre = [0] * N2
    dp = [0] * N2
    for i in range(len(X)):
        x = X[i]
        for j in range(N2):
            v = pre[j ^ x]
            dp[j] = v
            ans[j] += v
        dp[x] += 1
        ans[x] += 1
        pre, dp = dp, pre
    return ans

N, M, K = map(int, input().split())
mod = 10 ** 9 + 7
A = list(map(int, input().split()))
B = list(map(int, input().split()))
DA, DB = f(A), f(B)
ans = 0
for i in range(N2):
    ans += DA[i] * DB[i^K]
    ans %= mod

print(ans)
0