結果

問題 No.1210 XOR Grid
ユーザー Rho
提出日時 2020-07-29 15:51:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 267 ms / 2,000 ms
コード長 708 bytes
コンパイル時間 1,611 ms
コンパイル使用メモリ 166,924 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 23:56:19
合計ジャッジ時間 10,543 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 57
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define vi vector<int>
#define all(a) a.begin(),a.end()
typedef pair<int,int> P;
const long long mod=1000000007;
const long long inf=1ll<<61;
int modpow(int a,int x){
  int res=1;
  while(x){
    if(x&1)res=res*a%mod;
    a=a*a%mod;
    x>>=1;
  }
  return res;
}
signed main(){
  int n,m,x;cin>>n>>m>>x;
  assert(1<=n&&n<=200000&&1<=m&&m<=200000&&1<=x&&x<=60);
  int A=0,B=0;
  rep(i,n){
    int a;cin>>a;A^=a;
    assert(0<=a&&a<(1ll<<x));
  }
  rep(i,m){
    int b;cin>>b;B^=b;
    assert(0<=b&&b<(1ll<<x));
  }
  if(A!=B)cout<<0<<endl;
  else{
    cout<<modpow(modpow(2,(n-1)*(m-1)),x)<<endl;
  }
}
0