結果
| 問題 |
No.1210 XOR Grid
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-30 16:52:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 2,000 ms |
| コード長 | 996 bytes |
| コンパイル時間 | 803 ms |
| コンパイル使用メモリ | 82,676 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2024-11-15 11:35:56 |
| 合計ジャッジ時間 | 4,498 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 57 |
ソースコード
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>
using namespace std;
#define int long long
#define endl "\n"
constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007;
struct fast_io {
fast_io(){
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
};
} fio;
long long power(long long x, long long n){
long long ans = 1;
for(;n;n >>= 1ll, x *= x, ans %= MOD, x %= MOD)
if(n&1ll)ans*=x;
return ans % MOD;
}
signed main(){
cout<<fixed<<setprecision(10);
int N, M, X;
vector<int> A, B;
cin>>N>>M>>X;
A.resize(N);
B.resize(M);
for(int i = 0; i < N; i++){
cin>>A[i];
}
for(int j = 0; j < M; j++){
cin>>B[j];
}
int XORA = 0;
for(int i = 0; i < N; i++){
XORA ^= A[i];
}
int XORB = 0;
for(int i = 0; i < M; i++){
XORB ^= B[i];
}
if(XORB == XORA)cout<<power(2, (N-1) * (M-1) * X) % MOD<<endl;
else cout<<0<<endl;
return 0;
}