結果

問題 No.2024 Xer
ユーザー phspls
提出日時 2022-09-04 20:33:14
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 595 bytes
コンパイル時間 13,573 ms
コンパイル使用メモリ 380,160 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2024-11-19 03:27:18
合計ジャッジ時間 16,150 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

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));
    for i in 0..n-1 {
        if !(a[i] < a[i+1] ^ x && a[i] ^ x < a[i+1]) {
            println!("No");
            return;
        }
    }
    println!("Yes");
}
0