結果

問題 No.2024 Xer
ユーザー umezoumezo
提出日時 2022-07-29 23:18:03
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 694 bytes
コンパイル時間 2,365 ms
コンパイル使用メモリ 202,808 KB
最終ジャッジ日時 2025-01-30 15:43:05
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n,x;
  cin>>n>>x;
  vector<int> A(n);
  rep(i,n) cin>>A[i];
  vector<pair<int,int>> B(n);
  rep(i,n) B[i]={A[i]-(A[i]&x),i};
  sort(ALL(B));
  vector<int> C(n),D(n);
  rep(i,n){
    if(i%2==0) C[i]=A[B[i].second],D[i]=(A[B[i].second]^x);
    else C[i]=(A[B[i].second]^x),D[i]=A[B[i].second];
  }
  bool b=true;
  rep(i,n-1){
    if(C[i]>=C[i+1]) b=false;
    if(D[i]>=D[i+1]) b=false;
  }
  if(b) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
  
  
    
  return 0;
}
0