結果

問題 No.1142 XOR と XOR
ユーザー kyoprounokyoprouno
提出日時 2020-08-01 20:15:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 801 ms / 2,000 ms
コード長 1,479 bytes
コンパイル時間 2,226 ms
コンパイル使用メモリ 174,968 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 16:38:07
合計ジャッジ時間 14,698 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,812 KB
testcase_01 AC 3 ms
6,940 KB
testcase_02 AC 3 ms
6,944 KB
testcase_03 AC 801 ms
6,940 KB
testcase_04 AC 637 ms
6,944 KB
testcase_05 AC 500 ms
6,940 KB
testcase_06 AC 661 ms
6,940 KB
testcase_07 AC 792 ms
6,944 KB
testcase_08 AC 787 ms
6,944 KB
testcase_09 AC 784 ms
6,940 KB
testcase_10 AC 791 ms
6,944 KB
testcase_11 AC 3 ms
6,944 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 3 ms
6,944 KB
testcase_14 AC 433 ms
6,940 KB
testcase_15 AC 415 ms
6,944 KB
testcase_16 AC 37 ms
6,940 KB
testcase_17 AC 609 ms
6,940 KB
testcase_18 AC 133 ms
6,940 KB
testcase_19 AC 654 ms
6,944 KB
testcase_20 AC 411 ms
6,944 KB
testcase_21 AC 265 ms
6,940 KB
testcase_22 AC 150 ms
6,944 KB
testcase_23 AC 613 ms
6,944 KB
testcase_24 AC 701 ms
6,944 KB
testcase_25 AC 404 ms
6,940 KB
testcase_26 AC 657 ms
6,940 KB
testcase_27 AC 511 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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;
const ll mod=1e9+7;
const double eps=0.000000001;

int main(){
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> a(n),b(m);
    vector<ll> p(1024),q(1024),x(1024),y(1024);
    rep(i,n){
        cin >> a[i];
    }
    rep(i,m){
        cin >> b[i];
    }
    ll s=0;
    p[s]=1;
    rep(i,n){
        s=s^a[i];
        rep(j,1024){
            ll val=s^j;
            x[val]+=p[j];
            x[val]%=mod;
        }
        p[s]++;
    }
    ll t=0;
    q[t]=1;
    rep(i,m){
        t=t^b[i];
        rep(j,1024){
            ll val=t^j;
            y[val]+=q[j];
            y[val]%=mod;
        }
        q[t]++;
    }
    ll ans=0;
    rep(i,1024){
        rep(j,1024){
            ll v=i^j;
            if(k==v){
                ans+=(x[i]*y[j])%mod;
                ans%=mod;
            }
        }
    }
    cout << ans << endl;
    return 0;
}
0