結果

問題 No.2024 Xer
ユーザー tnakao0123
提出日時 2022-07-31 12:50:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 729 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 46,636 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-20 22:37:55
合計ジャッジ時間 3,776 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2024.cc:  No.2024 Xer - yukicoder
 */

#include<cstdio>
#include<algorithm>
#include<utility>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

typedef pair<int,int> pii;

/* global variables */

int as[MAX_N];
pii ps[MAX_N];

/* subroutines */

/* main */

int main() {
  int n, x;
  scanf("%d%d", &n, &x);
  for (int i = 0; i < n; i++) scanf("%d", as + i);

  for (int i = 0; i < n; i++) ps[i] = pii(min(as[i], as[i] ^ x), as[i]);
  sort(ps, ps + n);

  for (int i = 0; i + 1 < n; i++) {
    int a0 = ps[i].second, x0 = a0 ^ x;
    int a1 = ps[i + 1].second, x1 = a1 ^ x;
    if (! (a0 < x1 && x0 < a1)) { puts("No"); return 0; }
  }

  puts("Yes");
  return 0;
}
0