結果

問題 No.2155 みちらcolor
ユーザー phspls
提出日時 2022-12-20 01:02:35
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 887 bytes
コンパイル時間 12,176 ms
コンパイル使用メモリ 379,332 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-18 01:40:32
合計ジャッジ時間 13,960 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 62 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused import: `std::collections::VecDeque`
 --> src/main.rs:1:5
  |
1 | use std::collections::VecDeque;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

ソースコード

diff #

use std::collections::VecDeque;


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

    let limit = m.max(l);
    let mut dp = vec![vec![false; limit+1]; n+1];
    dp[0][l] = true;
    for i in 0..n {
        for j in 0..=limit {
            if !dp[i][j] { continue; }
            dp[i+1][j] = true;
            let val = (j + a[i]) / 2;
            if val <= limit {
                dp[i+1][val] = true;
            }
        }
    }
    if dp[n][m] {
        println!("Yes");
    } else {
        println!("No");
    }
}
0