結果

問題 No.1142 XOR と XOR
ユーザー kyoprounokyoprouno
提出日時 2020-08-01 19:35:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,427 bytes
コンパイル時間 2,032 ms
コンパイル使用メモリ 175,440 KB
実行使用メモリ 13,872 KB
最終ジャッジ日時 2023-09-22 12:40:20
合計ジャッジ時間 8,175 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,756 KB
testcase_01 AC 3 ms
4,376 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

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),s(n+1),t(m+1);
    vector<ll> p(1024),q(1024);
    rep(i,n){
        cin >> a[i];
    }
    rep(i,m){
        cin >> b[i];
    }
    rep(i,n){
        s[i+1]=s[i]^a[i];
    }
    rep(i,m){
        t[i+1]=t[i]^b[i];
    }
    rep(i,n+1){
        for(ll j=i+1;j<n+1;j++){
            ll v=s[i]^s[j];
            p[v]++;
        }
    }
    rep(i,m+1){
        for(ll j=i+1;j<m+1;j++){
            ll v=t[i]^t[j];
            q[v]++;
        }
    }
    ll ans=0;
    rep(i,1024){
        rep(j,1024){
            ll v=i^j;
            if(k==v){
                ans+=(p[i]*q[j])%mod;
                ans%=mod;
            }
        }
    }
    cout << ans << endl;
    return 0;
}
0