結果

問題 No.1456 Range Xor
ユーザー milkcoffeemilkcoffee
提出日時 2021-03-31 22:08:11
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 2,787 bytes
コンパイル時間 1,728 ms
コンパイル使用メモリ 174,484 KB
実行使用メモリ 7,904 KB
最終ジャッジ日時 2023-08-22 02:09:21
合計ジャッジ時間 5,354 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 74 ms
7,756 KB
testcase_04 AC 74 ms
7,876 KB
testcase_05 AC 74 ms
7,716 KB
testcase_06 AC 75 ms
7,804 KB
testcase_07 AC 74 ms
7,804 KB
testcase_08 AC 74 ms
7,780 KB
testcase_09 AC 74 ms
7,764 KB
testcase_10 AC 73 ms
7,904 KB
testcase_11 AC 13 ms
4,376 KB
testcase_12 AC 6 ms
4,376 KB
testcase_13 AC 23 ms
4,380 KB
testcase_14 AC 23 ms
4,384 KB
testcase_15 AC 61 ms
6,728 KB
testcase_16 AC 57 ms
6,736 KB
testcase_17 AC 31 ms
5,260 KB
testcase_18 AC 22 ms
4,480 KB
testcase_19 AC 45 ms
5,928 KB
testcase_20 AC 56 ms
6,452 KB
testcase_21 AC 44 ms
5,668 KB
testcase_22 AC 46 ms
5,948 KB
testcase_23 AC 25 ms
4,592 KB
testcase_24 AC 11 ms
4,380 KB
testcase_25 AC 21 ms
4,476 KB
testcase_26 AC 35 ms
5,072 KB
testcase_27 AC 50 ms
6,288 KB
testcase_28 AC 18 ms
4,380 KB
testcase_29 AC 66 ms
7,252 KB
testcase_30 AC 69 ms
7,768 KB
testcase_31 AC 17 ms
4,380 KB
testcase_32 AC 13 ms
4,380 KB
testcase_33 AC 28 ms
5,132 KB
testcase_34 AC 69 ms
7,464 KB
testcase_35 AC 37 ms
5,396 KB
testcase_36 AC 73 ms
7,588 KB
testcase_37 AC 63 ms
7,248 KB
testcase_38 AC 12 ms
4,380 KB
testcase_39 AC 53 ms
6,448 KB
testcase_40 AC 52 ms
6,484 KB
testcase_41 AC 3 ms
4,376 KB
testcase_42 AC 8 ms
4,376 KB
testcase_43 AC 1 ms
4,376 KB
testcase_44 AC 1 ms
4,376 KB
testcase_45 AC 1 ms
4,380 KB
testcase_46 AC 1 ms
4,376 KB
testcase_47 AC 1 ms
4,376 KB
testcase_48 AC 0 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define forin(in ,n) for(ll i=0; i<n; i++) cin>>in[i]
#define forout(out) for(ll i=0; i<(ll)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep_up(i, a, n) for (ll i = a; i < n; ++i)
#define rep_down(i, a, n) for (ll i = a; i >= n; --i)
#define P pair<ll, ll>

#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define vvvll vector<vector<vector<ll>>>
#define vvll vector<vector<ll>>
#define vll vector<ll>
#define pqll priority_queue<ll>
#define pqllg priority_queue<ll, vector<ll>, greater<ll>>

constexpr ll INF = (1ll << 60);
//constexpr ll mod = 1000000007;
constexpr ll mod = 998244353;
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
void pt(T val) {
    cout << val << "\n";
}
template <typename T>
void pt_vll(vector<T> &v) {
    ll vs = v.size();
    rep(i, vs) {
        cout << v[i];

        if (i == vs - 1)
            cout << "\n";
        else
            cout << " ";
    }
}
ll mypow(ll a, ll n) {
    ll ret = 1;
    if(n==0) return 1;
    if(a==0) return 0;
    rep(i, n) {
        if (ret > (ll)(1e18 + 10) / a) return -1;
        ret *= a;
    }
    return ret;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll digsum(ll n) {
    ll res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

int main() {
    ll n,m,x=0,y,k,t,s,cnt,flag=0,ans=-INF;
    cin>>n>>k;
    vll a(n);
    vector<P> L(n+1);
    vector<P> R(n+1);
    rep(i,n){
        cin>>a[i];
        x^=a[i];
    }
    rep(i,n){
        L[i+1].fi=L[i].fi^a[i];
        L[i+1].se=i+1;
    }
    rep(i,n){
        R[i+1].fi=R[i].fi^a[n-i-1];
        R[i+1].se=i+1;
    }
    sort(all(R));
    vll r(n+1);
    rep(i,n+1){
        r[i]=R[i].fi;
    }
    rep(i,n+1){
        y=L[i].fi^x^k;
        t=lower_bound(all(r),y)-r.begin();
        s=upper_bound(all(r),y)-r.begin();
        while(t<s){
            if(L[i].se+R[t].se<n){
              flag=1;
            }
            t++;
        }
    }
    if(flag==1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
0