結果

問題 No.1870 Xor Matrix
ユーザー ShirotsumeShirotsume
提出日時 2022-03-11 22:49:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 361 ms / 2,000 ms
コード長 588 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 259,160 KB
最終ジャッジ日時 2023-10-14 08:05:02
合計ジャッジ時間 7,622 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,368 KB
testcase_01 AC 66 ms
71,512 KB
testcase_02 AC 66 ms
71,376 KB
testcase_03 AC 270 ms
187,304 KB
testcase_04 AC 337 ms
256,736 KB
testcase_05 AC 292 ms
202,920 KB
testcase_06 AC 272 ms
214,804 KB
testcase_07 AC 308 ms
237,516 KB
testcase_08 AC 319 ms
246,504 KB
testcase_09 AC 247 ms
161,364 KB
testcase_10 AC 273 ms
200,072 KB
testcase_11 AC 313 ms
230,100 KB
testcase_12 AC 312 ms
226,484 KB
testcase_13 AC 208 ms
157,352 KB
testcase_14 AC 348 ms
258,644 KB
testcase_15 AC 207 ms
155,056 KB
testcase_16 AC 222 ms
174,956 KB
testcase_17 AC 361 ms
259,160 KB
testcase_18 AC 339 ms
216,860 KB
testcase_19 AC 321 ms
244,972 KB
testcase_20 AC 289 ms
192,148 KB
testcase_21 AC 208 ms
162,832 KB
testcase_22 AC 246 ms
187,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int,input().split())
mod = 998244353
A = list(map(int,input().split()))
B = list(map(int,input().split()))

def solve(bit):
    a = []
    b = []

    for i in range(n):
        a.append(1 if 1 & (A[i] >> bit) else 0)
    for i in range(m):
        b.append(1 if 1 & (B[i] >> bit) else 0)
    
    if sum(a) % 2 != sum(b) % 2:
        return 0
    else:
        time = pow(2, n + m - 1, mod)
        al = pow(2, n * m, mod)
        ans = (al * pow(time, mod - 2, mod)) % mod
        return ans
    
ans = 1
for i in range(20):
    ans *= solve(i)
    ans %= mod
print(ans)




0