結果

問題 No.1210 XOR Grid
ユーザー chocorusk
提出日時 2020-08-30 22:21:38
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 357 ms / 2,000 ms
コード長 1,122 bytes
コンパイル時間 2,125 ms
コンパイル使用メモリ 122,880 KB
最終ジャッジ日時 2025-01-14 02:11:00
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 57
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
int main()
{
	int n, m, x; cin>>n>>m>>x;
	ll a[200020], b[200020];
	for(int i=0; i<n; i++) cin>>a[i];
	for(int i=0; i<m; i++) cin>>b[i];
	ll sa=0, sb=0;
	for(int i=0; i<n; i++) sa^=a[i];
	for(int i=0; i<m; i++) sb^=b[i];
	if(sa!=sb){
		cout<<0<<endl;
		return 0;
	}
	cout<<powmod(2, (ll)(n-1)*(m-1)*x)<<endl;
	return 0;
}
0