結果

問題 No.1210 XOR Grid
ユーザー poohbearpoohbear
提出日時 2020-08-30 19:16:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 271 ms / 2,000 ms
コード長 2,094 bytes
コンパイル時間 2,404 ms
コンパイル使用メモリ 203,052 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-27 13:05:24
合計ジャッジ時間 8,664 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 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,944 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 136 ms
6,944 KB
testcase_26 AC 134 ms
6,940 KB
testcase_27 AC 134 ms
6,940 KB
testcase_28 AC 135 ms
6,940 KB
testcase_29 AC 136 ms
6,940 KB
testcase_30 AC 105 ms
6,940 KB
testcase_31 AC 136 ms
6,944 KB
testcase_32 AC 138 ms
6,944 KB
testcase_33 AC 2 ms
6,944 KB
testcase_34 AC 2 ms
6,940 KB
testcase_35 AC 2 ms
6,940 KB
testcase_36 AC 32 ms
6,940 KB
testcase_37 AC 33 ms
6,944 KB
testcase_38 AC 32 ms
6,944 KB
testcase_39 AC 31 ms
6,940 KB
testcase_40 AC 62 ms
6,940 KB
testcase_41 AC 62 ms
6,944 KB
testcase_42 AC 269 ms
6,944 KB
testcase_43 AC 229 ms
6,944 KB
testcase_44 AC 271 ms
6,944 KB
testcase_45 AC 271 ms
6,944 KB
testcase_46 AC 261 ms
6,940 KB
testcase_47 AC 65 ms
6,940 KB
testcase_48 AC 64 ms
6,944 KB
testcase_49 AC 2 ms
6,944 KB
testcase_50 AC 122 ms
6,940 KB
testcase_51 AC 266 ms
6,944 KB
testcase_52 AC 223 ms
6,940 KB
testcase_53 AC 266 ms
6,944 KB
testcase_54 AC 64 ms
6,940 KB
testcase_55 AC 157 ms
6,940 KB
testcase_56 AC 135 ms
6,940 KB
testcase_57 AC 139 ms
6,944 KB
testcase_58 AC 2 ms
6,940 KB
testcase_59 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(a,n) for (int a = 0; a < (n); ++a)
using namespace std;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

// auto mod int
// depends on Template

const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


//input
ll N,M,X;


int main(){
    cin >> N >> M >> X;
    vector<ll>a(N),b(M);
    rep(i,N)cin>>a[i];
    rep(i,M)cin>>b[i];
    ll xa = 0, xb = 0;
    rep(i,N)xa ^= a[i];
    rep(i,M)xb ^= b[i];
    if(xa!=xb){
        cout << 0 << endl;
        return 0;
    }
    ll tmp;
    tmp = X * (M-1) * (N-1);
    cout << modpow(2,tmp) << endl;

    return 0;
}
0