結果

問題 No.2024 Xer
ユーザー wanuiwanui
提出日時 2022-07-29 22:43:34
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 1,782 bytes
コンパイル時間 2,197 ms
コンパイル使用メモリ 203,708 KB
実行使用メモリ 12,372 KB
最終ジャッジ日時 2023-09-26 22:08:59
合計ジャッジ時間 5,470 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 90 ms
11,336 KB
testcase_08 AC 71 ms
12,372 KB
testcase_09 AC 27 ms
5,216 KB
testcase_10 AC 71 ms
12,236 KB
testcase_11 AC 30 ms
5,260 KB
testcase_12 AC 50 ms
7,044 KB
testcase_13 AC 57 ms
7,292 KB
testcase_14 AC 90 ms
11,664 KB
testcase_15 AC 40 ms
6,816 KB
testcase_16 AC 62 ms
9,252 KB
testcase_17 AC 11 ms
4,384 KB
testcase_18 AC 35 ms
6,880 KB
testcase_19 AC 89 ms
9,564 KB
testcase_20 AC 20 ms
6,472 KB
testcase_21 AC 28 ms
5,944 KB
testcase_22 AC 35 ms
9,380 KB
testcase_23 AC 34 ms
9,104 KB
testcase_24 AC 28 ms
6,228 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 3 ms
4,380 KB
testcase_32 AC 3 ms
4,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 2 ms
4,380 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 2 ms
4,376 KB
testcase_41 AC 3 ms
4,376 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 3 ms
4,380 KB
testcase_44 AC 3 ms
4,380 KB
testcase_45 AC 21 ms
4,668 KB
testcase_46 AC 6 ms
4,380 KB
testcase_47 AC 16 ms
4,380 KB
testcase_48 AC 1 ms
4,380 KB
testcase_49 AC 2 ms
4,376 KB
testcase_50 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; const ll INF=4e18;
void print0(){}; template<typename H,typename... T> void print0(H h,T... t){cout<<h;print0(t...);}
void print(){print0("\n");}; template<typename H,typename... T>void print(H h,T... t){print0(h);if(sizeof...(T)>0)print0(" ");print(t...);}
void perr0(){}; template<typename H,typename... T> void perr0(H h,T... t){cerr<<h;perr0(t...);}
void perr(){perr0("\n");}; template<typename H,typename... T>void perr(H h,T... t){perr0(h);if(sizeof...(T)>0)perr0(" ");perr(t...);}
void ioinit() { cout<<fixed<<setprecision(15); cerr<<fixed<<setprecision(6); ios_base::sync_with_stdio(0); cin.tie(0); }
// clang-format on

// クイックソート
mt19937 engine(2021);
ll X;
ll randint(ll mn, ll mx) {
    ll rng = mx - mn + 1;
    return mn + (engine() % rng);
}
bool gt(ll a, ll b) {
    if (a < (b ^ X) && (a ^ X) < b) {
        return true;
    }
    if (a < b && (a ^ X) < (b ^ X)) {
        return true;
    }
    return false;
}
void myqsort(vector<ll>& A) {
    if (A.size() <= 1) {
        return;
    }
    ll n = A.size();
    ll k = randint(0, n - 1);
    ll base = A[k];
    vector<ll> large;
    vector<ll> small;
    for (ll i = 0; i < n; i++) {
        if (i == k) continue;
        if (gt(base, A[i])) {
            large.push_back(A[i]);
        } else if (gt(A[i], base)) {
            small.push_back(A[i]);
        } else {
            print("No");
            exit(0);
        }
    }
    myqsort(large);
    myqsort(small);
}
int main() {
    ioinit();
    ll N;
    cin >> N >> X;
    vector<ll> A(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }
    myqsort(A);
    print("Yes");
    return 0;
}
0