結果

問題 No.1210 XOR Grid
ユーザー bachoppibachoppi
提出日時 2020-08-30 17:50:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 236 ms / 2,000 ms
コード長 975 bytes
コンパイル時間 1,193 ms
コンパイル使用メモリ 120,244 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-27 12:39:08
合計ジャッジ時間 7,469 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 1 ms
6,944 KB
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 1 ms
6,940 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 1 ms
6,940 KB
testcase_23 AC 1 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 118 ms
6,944 KB
testcase_26 AC 118 ms
6,940 KB
testcase_27 AC 115 ms
6,944 KB
testcase_28 AC 116 ms
6,940 KB
testcase_29 AC 116 ms
6,940 KB
testcase_30 AC 93 ms
6,944 KB
testcase_31 AC 119 ms
6,940 KB
testcase_32 AC 120 ms
6,940 KB
testcase_33 AC 1 ms
6,944 KB
testcase_34 AC 2 ms
6,940 KB
testcase_35 AC 2 ms
6,940 KB
testcase_36 AC 27 ms
6,944 KB
testcase_37 AC 28 ms
6,944 KB
testcase_38 AC 28 ms
6,944 KB
testcase_39 AC 28 ms
6,940 KB
testcase_40 AC 53 ms
6,944 KB
testcase_41 AC 52 ms
6,940 KB
testcase_42 AC 232 ms
6,944 KB
testcase_43 AC 200 ms
6,944 KB
testcase_44 AC 234 ms
6,944 KB
testcase_45 AC 235 ms
6,940 KB
testcase_46 AC 227 ms
6,940 KB
testcase_47 AC 56 ms
6,940 KB
testcase_48 AC 56 ms
6,940 KB
testcase_49 AC 2 ms
6,944 KB
testcase_50 AC 106 ms
6,940 KB
testcase_51 AC 235 ms
6,944 KB
testcase_52 AC 205 ms
6,944 KB
testcase_53 AC 236 ms
6,940 KB
testcase_54 AC 59 ms
6,940 KB
testcase_55 AC 138 ms
6,940 KB
testcase_56 AC 118 ms
6,944 KB
testcase_57 AC 118 ms
6,940 KB
testcase_58 AC 2 ms
6,940 KB
testcase_59 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'll modpow(ll, ll, ll)':
main.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
   34 | }
      | ^

ソースコード

diff #

#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

ll modpow(ll a, ll n, ll p){
	if(n==0) return 1;
	if(n%2) return (a*modpow(a, n-1, p))%p;
	if(!(n%2)){
		ll t=modpow(a, n/2, p);
		return (t*t)%p;
	}
}



int main(){
  ll n, m, x; cin >> n >> m >> x; ll a[n], b[m];
  ll tate=0, yoko=0;
  rep(i, n){
    cin >> a[i]; tate^=a[i];
  }
  rep(i, m){
    cin >> b[i]; yoko^=b[i];
  }
  if(tate!=yoko){
    cout << 0 << endl; 
  }
  else{
    cout << (ll)modpow(2, (m-1)*(n-1)*x, mod)%mod << endl;
  }
}
0