結果

問題 No.669 対決!!! 飲み比べ
ユーザー fukafukatani
提出日時 2019-02-04 22:38:06
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 739 bytes
コンパイル時間 19,551 ms
コンパイル使用メモリ 379,080 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 01:45:00
合計ジャッジ時間 12,935 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let v: Vec<u64> = read_vec();
    let (_, k) = (v[0], v[1]);
    let a: Vec<u64> = read_vec();
    let grundy = a.iter().map(|x| x % k).collect::<Vec<_>>();
    let mut nim = 0;
    for num in grundy {
        nim ^= num;
    }
    if nim == 0 {
        println!("NO");
    } else {
        println!("YES");
    }
}
0