結果
| 問題 |
No.1870 Xor Matrix
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2022-03-11 21:31:39 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 130 ms / 2,000 ms |
| コード長 | 672 bytes |
| コンパイル時間 | 3,979 ms |
| コンパイル使用メモリ | 251,872 KB |
| 最終ジャッジ日時 | 2025-01-28 08:13:52 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define Inf 1000000001
int n,m;
mint get(vector<int> a,vector<int> b){
int t = 0;
rep(i,n)t ^= a[i];
rep(i,m)t ^= b[i];
if(t==1)return 0;
long long L = n-1;
L *= m-1;
mint x = mint(2).pow(L);
return x;
}
int main(){
cin>>n>>m;
vector<int> a(n),b(m);
rep(i,n)cin>>a[i];
rep(i,m)cin>>b[i];
mint ans = 1;
rep(i,20){
vector<int> aa(n),bb(m);
rep(j,n)aa[j] = (a[j]>>i)&1;
rep(j,m)bb[j] = (b[j]>>i)&1;
ans *= get(aa,bb);
}
cout<<ans.val()<<endl;
return 0;
}
沙耶花