結果

問題 No.1870 Xor Matrix
ユーザー kai4096_donkai4096_don
提出日時 2022-03-11 22:08:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 915 bytes
コンパイル時間 3,524 ms
コンパイル使用メモリ 227,808 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-14 07:18:40
合計ジャッジ時間 5,832 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 47 ms
4,352 KB
testcase_04 AC 75 ms
4,348 KB
testcase_05 AC 46 ms
4,348 KB
testcase_06 AC 54 ms
4,348 KB
testcase_07 AC 65 ms
4,348 KB
testcase_08 AC 66 ms
4,352 KB
testcase_09 AC 40 ms
4,348 KB
testcase_10 AC 56 ms
4,348 KB
testcase_11 AC 62 ms
4,348 KB
testcase_12 AC 65 ms
4,352 KB
testcase_13 AC 38 ms
4,352 KB
testcase_14 AC 73 ms
4,348 KB
testcase_15 AC 37 ms
4,352 KB
testcase_16 AC 44 ms
4,348 KB
testcase_17 AC 80 ms
4,352 KB
testcase_18 AC 57 ms
4,348 KB
testcase_19 AC 67 ms
4,352 KB
testcase_20 AC 50 ms
4,352 KB
testcase_21 AC 31 ms
4,348 KB
testcase_22 AC 46 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

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