結果
問題 | No.1870 Xor Matrix |
ユーザー |
👑 ![]() |
提出日時 | 2022-03-11 21:49:20 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 220 ms / 2,000 ms |
コード長 | 721 bytes |
コンパイル時間 | 305 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 105,984 KB |
最終ジャッジ日時 | 2024-09-16 02:02:27 |
合計ジャッジ時間 | 4,916 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
"""まぁBitごとに解けばよい1の個数の偶奇が与えられるまず、不可の場合を考えよう縦と横の1の個数の偶奇が違うそれ以外は、2^((n-1)*(m-1)) が出来そう"""import sysfrom sys import stdinimport heapqN,M = map(int,stdin.readline().split())a = list(map(int,stdin.readline().split()))b = list(map(int,stdin.readline().split()))mod = 998244353flag = Truefor i in range(20):x = 0y = 0for j in a:if 2**i & j > 0:x ^= 1for j in b:if 2**i & j > 0:y ^= 1if x != y:flag = Falseif flag:ans = pow( pow(2, (N-1)*(M-1) , mod ) ,20 , mod)print (ans)else:print (0)