結果

問題 No.2155 みちらcolor
ユーザー tonyu0tonyu0
提出日時 2022-12-09 22:01:28
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 869 bytes
コンパイル時間 14,306 ms
コンパイル使用メモリ 384,404 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-14 21:57:11
合計ジャッジ時間 15,897 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 64
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::{collections::HashSet, io::*};
fn main() {
    let mut input: String = String::new();
    std::io::stdin().read_to_string(&mut input).ok();
    let mut itr = input.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let m: usize = itr.next().unwrap().parse().unwrap();
    let l: usize = itr.next().unwrap().parse().unwrap();
    let a: Vec<usize> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    let mut st = HashSet::new();
    st.insert(l);
    for i in 0..n {
        let mut b = Vec::new();
        for &j in st.iter() {
            let k = (j + a[i]) / 2;
            if !st.contains(&k) {
                b.push(k);
            }
        }
        for &j in b.iter() {
            st.insert(j);
        }
    }
    println!("{}", if st.contains(&m) { "Yes" } else { "No" });
}
0