結果

問題 No.1210 XOR Grid
ユーザー 沙耶花沙耶花
提出日時 2020-08-30 14:21:03
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 205 ms / 2,000 ms
コード長 890 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 202,780 KB
実行使用メモリ 9,708 KB
最終ジャッジ日時 2023-08-09 12:24:20
合計ジャッジ時間 7,836 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 57 ms
6,272 KB
testcase_26 AC 55 ms
6,308 KB
testcase_27 AC 55 ms
6,396 KB
testcase_28 AC 55 ms
6,408 KB
testcase_29 AC 55 ms
6,296 KB
testcase_30 AC 44 ms
6,144 KB
testcase_31 AC 56 ms
6,292 KB
testcase_32 AC 56 ms
6,316 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 32 ms
6,352 KB
testcase_37 AC 32 ms
6,304 KB
testcase_38 AC 33 ms
6,328 KB
testcase_39 AC 25 ms
6,148 KB
testcase_40 AC 142 ms
9,400 KB
testcase_41 AC 156 ms
9,576 KB
testcase_42 AC 199 ms
9,440 KB
testcase_43 AC 167 ms
9,708 KB
testcase_44 AC 203 ms
9,560 KB
testcase_45 AC 205 ms
9,572 KB
testcase_46 AC 193 ms
9,332 KB
testcase_47 AC 36 ms
9,476 KB
testcase_48 AC 36 ms
9,396 KB
testcase_49 AC 2 ms
4,376 KB
testcase_50 AC 88 ms
9,416 KB
testcase_51 AC 197 ms
9,444 KB
testcase_52 AC 96 ms
8,784 KB
testcase_53 AC 194 ms
9,576 KB
testcase_54 AC 36 ms
9,440 KB
testcase_55 AC 174 ms
9,580 KB
testcase_56 AC 56 ms
6,292 KB
testcase_57 AC 61 ms
8,180 KB
testcase_58 AC 2 ms
4,376 KB
testcase_59 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 2000000000000000000
int N,M;
long long X;
int beki(long long a,long long b,int M = modulo){
	int x = 1;
	while(b!=0){
		if(b&1){
			x=((long long)x*a)%M;
		}
		a=((long long)a*a)%M;
		b>>=1;
	}
	return x;
}
int main(){
	
	cin>>N>>M;
	cin>>X;
	
	vector<long long> A(N),B(M);
	
	for(int i=0;i<N;i++)scanf("%lld",&A[i]);
	for(int i=0;i<M;i++)scanf("%lld",&B[i]);
	
	long long ans = 1LL;
	long long K = ((long long)N-1)*((long long)M-1);

	for(int i=0;i<X;i++){
		vector<long long> a(N),b(M);
		int sum = 0;
		for(int j=0;j<N;j++){
			a[j] = (A[j]>>i)&1;
			sum += a[j];
		}
		for(int j=0;j<M;j++){
			b[j] = (B[j]>>i)&1;
			sum += b[j];
		}
		
		if(sum%2==1)ans = 0LL;
		else{
			ans = mod(ans * beki(2,K));
		}
		
	}
	
	cout<<ans<<endl;
	
	return 0;
}
0