結果

問題 No.1210 XOR Grid
ユーザー furafura
提出日時 2020-09-26 17:35:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 1,807 bytes
コンパイル時間 2,217 ms
コンパイル使用メモリ 201,736 KB
実行使用メモリ 6,312 KB
最終ジャッジ日時 2023-09-11 21:55:09
合計ジャッジ時間 10,556 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,384 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 40 ms
4,652 KB
testcase_26 AC 40 ms
4,620 KB
testcase_27 AC 39 ms
4,664 KB
testcase_28 AC 40 ms
4,756 KB
testcase_29 AC 40 ms
4,616 KB
testcase_30 AC 32 ms
4,428 KB
testcase_31 AC 40 ms
4,704 KB
testcase_32 AC 40 ms
4,660 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 17 ms
4,784 KB
testcase_37 AC 17 ms
4,628 KB
testcase_38 AC 17 ms
4,612 KB
testcase_39 AC 17 ms
4,656 KB
testcase_40 AC 32 ms
6,308 KB
testcase_41 AC 32 ms
6,312 KB
testcase_42 AC 77 ms
6,272 KB
testcase_43 AC 69 ms
6,204 KB
testcase_44 AC 77 ms
6,196 KB
testcase_45 AC 78 ms
6,312 KB
testcase_46 AC 75 ms
6,200 KB
testcase_47 AC 34 ms
6,148 KB
testcase_48 AC 34 ms
6,288 KB
testcase_49 AC 2 ms
4,380 KB
testcase_50 AC 47 ms
6,144 KB
testcase_51 AC 76 ms
6,284 KB
testcase_52 AC 67 ms
5,944 KB
testcase_53 AC 77 ms
6,308 KB
testcase_54 AC 35 ms
6,156 KB
testcase_55 AC 54 ms
6,196 KB
testcase_56 AC 39 ms
4,564 KB
testcase_57 AC 45 ms
5,408 KB
testcase_58 AC 2 ms
4,380 KB
testcase_59 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

class mint{
	static const int MOD=1e9+7;
	int x;
public:
	mint():x(0){}
	mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }

	mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
	mint& operator-=(const mint& m){ x-=m.x; if(x<   0) x+=MOD; return *this; }
	mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
	mint& operator/=(const mint& m){ return *this*=inverse(m); }
	mint operator+(const mint& m)const{ return mint(*this)+=m; }
	mint operator-(const mint& m)const{ return mint(*this)-=m; }
	mint operator*(const mint& m)const{ return mint(*this)*=m; }
	mint operator/(const mint& m)const{ return mint(*this)/=m; }
	mint operator-()const{ return mint(-x); }

	friend mint inverse(const mint& m){
		int a=m.x,b=MOD,u=1,v=0;
		while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
		return u;
	}

	friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
	friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
	int to_int()const{ return x; }
};

mint operator+(long long x,const mint& m){ return mint(x)+m; }
mint operator-(long long x,const mint& m){ return mint(x)-m; }
mint operator*(long long x,const mint& m){ return mint(x)*m; }
mint operator/(long long x,const mint& m){ return mint(x)/m; }

mint pow(mint m,long long k){
	mint res=1;
	for(;k>0;k>>=1,m*=m) if(k&1) res*=m;
	return res;
}

int main(){
	int h,w,x; scanf("%d%d%d",&h,&w,&x);
	vector<lint> a(h),b(w);
	rep(i,h) scanf("%lld",&a[i]);
	rep(j,w) scanf("%lld",&b[j]);

	lint row=0,col=0;
	rep(i,h) row^=a[i];
	rep(j,w) col^=b[j];
	if(row!=col){
		puts("0");
		return 0;
	}

	cout<<pow(mint(2),lint(h-1)*(w-1)*x)<<'\n';

	return 0;
}
0