結果
| 問題 | No.1870 Xor Matrix | 
| コンテスト | |
| ユーザー |  se1ka2 | 
| 提出日時 | 2022-03-11 21:58:44 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 91 ms / 2,000 ms | 
| コード長 | 729 bytes | 
| コンパイル時間 | 540 ms | 
| コンパイル使用メモリ | 67,456 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-16 02:12:56 | 
| 合計ジャッジ時間 | 2,805 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge6 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 | 
ソースコード
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
long long modpow(long long x, long long n){
    long long  res = 1;
    long long mul = x;
    while(n){
        if(n % 2) res = res * mul % MOD;
        mul = mul * mul % MOD;
        n /= 2;
    }
    return res;
}
int main()
{
    ll n, m;
	cin >> n >> m;
    int c[22]{0};
    for(int i = 0; i < n + m; i++){
        int a;
        cin >> a;
        for(int j = 0; j < 20; j++){
            c[j] += (a >> j) & 1;
        }
    }
    bool f = true;
    for(int j = 0; j < 20; j++){
        if(c[j] % 2) f = false;
    }
    if(!f) cout << 0 << endl;
	else cout << modpow(modpow(2, (n - 1) * (m - 1)), 20) << endl;
}
            
            
            
        