結果

問題 No.1870 Xor Matrix
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2022-03-11 21:49:20
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 226 ms / 2,000 ms
コード長 721 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 101,548 KB
最終ジャッジ日時 2023-10-14 06:55:26
合計ジャッジ時間 5,764 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,360 KB
testcase_01 AC 69 ms
71,276 KB
testcase_02 AC 69 ms
71,076 KB
testcase_03 AC 181 ms
93,628 KB
testcase_04 AC 223 ms
96,776 KB
testcase_05 AC 172 ms
94,084 KB
testcase_06 AC 187 ms
94,692 KB
testcase_07 AC 203 ms
96,940 KB
testcase_08 AC 206 ms
97,820 KB
testcase_09 AC 162 ms
90,368 KB
testcase_10 AC 190 ms
96,368 KB
testcase_11 AC 200 ms
101,548 KB
testcase_12 AC 211 ms
100,524 KB
testcase_13 AC 151 ms
92,360 KB
testcase_14 AC 220 ms
99,144 KB
testcase_15 AC 152 ms
92,364 KB
testcase_16 AC 163 ms
93,860 KB
testcase_17 AC 226 ms
101,264 KB
testcase_18 AC 187 ms
92,260 KB
testcase_19 AC 208 ms
95,336 KB
testcase_20 AC 178 ms
94,964 KB
testcase_21 AC 137 ms
90,256 KB
testcase_22 AC 172 ms
94,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

まぁ
Bitごとに解けばよい

1の個数の偶奇が与えられる

まず、不可の場合を考えよう
縦と横の1の個数の偶奇が違う
それ以外は、2^((n-1)*(m-1)) が出来そう

"""

import sys
from sys import stdin
import heapq

N,M = map(int,stdin.readline().split())

a = list(map(int,stdin.readline().split()))
b = list(map(int,stdin.readline().split()))

mod = 998244353

flag = True
for i in range(20):

    x = 0
    y = 0
    for j in a:
        if 2**i & j > 0:
            x ^= 1
    for j in b:
        if 2**i & j > 0:
            y ^= 1

    if x != y:
        flag = False

if flag:
    ans = pow( pow(2, (N-1)*(M-1) , mod ) ,20 , mod)
    print (ans)
else:
    print (0)
0