結果

問題 No.2024 Xer
ユーザー momoyuu
提出日時 2023-09-17 00:35:31
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 3,384 ms
コンパイル使用メモリ 250,496 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-03 23:01:28
合計ジャッジ時間 6,783 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    ll n,x;
    cin>>n>>x;
    vector<ll> a(n);
    for(int i = 0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.end(),[&](ll i,ll j){
        ll ni = i + (i^x);
        ll nj = j + (j^x);
        return ni < nj;});
    bool fn = true;
    for(int i = 0;i+1<n;i++){
        if(a[i]>=(a[i+1]^x)) fn = false;
        if((a[i]^x)>=a[i+1]) fn = false;
    }
    if(fn) cout<<"Yes\n";
    else cout<<"No\n";

}

0