結果

問題 No.1870 Xor Matrix
ユーザー kai4096_don
提出日時 2022-03-11 22:08:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 915 bytes
コンパイル時間 3,681 ms
コンパイル使用メモリ 228,552 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-16 02:26:36
合計ジャッジ時間 5,889 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
//const long nPrime = 1000000007;
const long nPrime = 998244353;
typedef long long ll;

long LF_Pow(long nBase, long nExp){
    if(nExp < 0){
        return -1;
    }
    long iTmp = nBase % nPrime;
    long nReturn = 1;
    while (nExp > 0){
        if(nExp % 2 == 1){
            nReturn *= iTmp;
            nReturn %= nPrime;
        }
        iTmp = iTmp * iTmp;  
        iTmp %= nPrime;
        nExp /= 2;
    }
    return nReturn;    
}
int main() {
    ll n,m;
    cin >> n >> m;
    ll nSum=0;
    for(ll i = 0; i < n; i++){
        ll x;
        cin >> x;
        nSum ^= x;
    }
    for(ll i = 0; i < m; i++){
        ll x;
        cin >> x;
        nSum ^= x;
    }
    
    if(nSum != 0){
        cout << 0 << endl;
        return 0;
    }
    
    cout << LF_Pow(2, 20*(n-1)*(m-1)) <<endl;
    return 0;
}
0