結果

問題 No.2024 Xer
コンテスト
ユーザー phspls
提出日時 2022-09-04 01:10:54
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 615 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,459 ms
コンパイル使用メモリ 199,584 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2026-05-12 11:47:44
合計ジャッジ時間 5,767 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn main() {
    let mut nx = String::new();
    std::io::stdin().read_line(&mut nx).ok();
    let nx: Vec<usize> = nx.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = nx[0];
    let x = nx[1];
    let mut a = String::new();
    std::io::stdin().read_line(&mut a).ok();
    let mut a: Vec<usize> = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();

    a.sort_by_key(|&v| v.min(v ^ x));
    let result = (0..n-1).filter(|&i| (a[i] < a[i+1] ^ x) && (a[i] ^ x < a[i+1])).count() == n-1;
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}
0