# 2020ICPC 济南site A Matrix Equation bitset + 异或高斯消元

## 代码

```#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
ll quick_pow(ll x,ll y){
ll res = 1;
while(y){
if(y & 1)
res = res * x % mod;
x = x * x % mod;
y >>= 1;
}
return res;
}
const int maxn = 205;
int a[maxn][maxn],b[maxn][maxn];
bitset<maxn>bs[maxn],bd[maxn],t;
int n;
ll ans;
void swap(bitset<maxn> &x,bitset<maxn> &y){
t.reset();
t |= y;
y.reset();
y |= x;
x.reset();
x |= t;
return;
}
int Guass(){
int maxrow,row = 0,col = 0,num = 0;
for(row = 0;row < n && col < n;row++,col++){
maxrow = row;
for(int i = row + 1;i < n;++i){
if(bd[i][col] > bd[maxrow][col]){
maxrow = i;
break;
}
}
if(maxrow != row){
swap(bd[maxrow],bd[row]);
}
if(bd[row][col] == 0){
num++;
row--;
continue;
}
for(int i = row + 1;i < n;++i){
if(bd[i][col] != 0){
bd[i] ^= bd[row];
}
}
}
return num;
}
void solve(int x){
for(int i = 0;i < n;++i)
bd[i].reset();
for(int i = 0;i < n;++i){
bd[i] |= bs[i];
bd[i][i] = b[i][x] ^ bd[i][i];
}
int num = Guass();
if(num == -1){
ans = 0;
}
else ans = ans * quick_pow(2,num) % mod;
}
int main(){
cin >> n;
ans = 1;
for(int i = 0;i < n;++i)
bs[i].reset();
for(int i = 0;i < n;++i)
for(int j = 0;j < n;++j)
cin >> a[i][j],bs[i].set(j,a[i][j] == 1);
for(int i = 0;i < n;++i)
for(int j = 0;j < n;++j)
cin >> b[i][j];
for(int i = 0;i < n;++i){
solve(i);
}
cout << ans << endl;
return 0;
}```