結果
問題 | No.1210 XOR Grid |
ユーザー |
![]() |
提出日時 | 2020-08-30 13:53:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 378 ms / 2,000 ms |
コード長 | 799 bytes |
コンパイル時間 | 734 ms |
コンパイル使用メモリ | 66,688 KB |
最終ジャッジ日時 | 2025-01-13 21:27:12 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 57 |
ソースコード
#include <iostream>using namespace std;typedef long long ll;ll a[200010],b[200010],mod = 1000000007;ll pw(ll a, ll x){ll ret = 1;while(x){if(x&1) (ret *= a) %= mod;x /= 2; (a *= a) %= mod;}return ret;}int cnt[60] = {};int main(){ll i,n,m,x; cin >> n >> m >> x;for(i=0;i<n;i++){cin >> a[i];int d = 0;while(a[i]){cnt[d] += a[i]&1; a[i] /= 2; d++;}}for(i=0;i<m;i++){cin >> b[i];int d = 0;while(b[i]){cnt[d] += b[i]&1; b[i] /= 2; d++;}}for(i=0;i<x;i++){if(cnt[i]&1){cout << 0 << endl;return 0;}}ll ans = pw(2,(n - 1)*(m - 1));ans = pw(ans,x);cout << ans << endl;}