結果
| 問題 | No.1210 XOR Grid | 
| コンテスト | |
| ユーザー |  沙耶花 | 
| 提出日時 | 2020-08-30 14:21:03 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 245 ms / 2,000 ms | 
| コード長 | 890 bytes | 
| コンパイル時間 | 2,377 ms | 
| コンパイル使用メモリ | 195,136 KB | 
| 最終ジャッジ日時 | 2025-01-13 21:47:19 | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 57 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |         for(int i=0;i<N;i++)scanf("%lld",&A[i]);
      |                             ~~~~~^~~~~~~~~~~~~~
main.cpp:27:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   27 |         for(int i=0;i<M;i++)scanf("%lld",&B[i]);
      |                             ~~~~~^~~~~~~~~~~~~~
            
            ソースコード
#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;
}
            
            
            
        