結果

問題 No.1210 XOR Grid
コンテスト
ユーザー bachoppi
提出日時 2020-08-30 17:50:31
言語 C++17
(gcc 13.3.0 + boost 1.89.0)
結果
AC  
実行時間 341 ms / 2,000 ms
コード長 975 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,273 ms
コンパイル使用メモリ 114,288 KB
最終ジャッジ日時 2025-01-14 01:53:10
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 57
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘ll modpow(ll, ll, ll)’: main.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type] 34 | } | ^ 

ソースコード

raw source code

#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