結果
問題 | No.1736 Princess vs. Dragoness |
ユーザー |
|
提出日時 | 2022-09-29 23:18:11 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 928 bytes |
コンパイル時間 | 13,147 ms |
コンパイル使用メモリ | 396,108 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-22 18:33:52 |
合計ジャッジ時間 | 14,639 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
コンパイルメッセージ
warning: unused variable: `n` --> src/main.rs:8:9 | 8 | let n = nabxy[0]; | ^ help: if this is intentional, prefix it with an underscore: `_n` | = note: `#[warn(unused_variables)]` on by default
ソースコード
use std::collections::BinaryHeap;fn main() {let mut nabxy = String::new();std::io::stdin().read_line(&mut nabxy).ok();let nabxy: Vec<usize> = nabxy.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();let n = nabxy[0];let mut a = nabxy[1];let b = nabxy[2];let x = nabxy[3];let y = nabxy[4];let mut h = String::new();std::io::stdin().read_line(&mut h).ok();let h: Vec<usize> = h.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();let mut pque = BinaryHeap::new();for &v in h.iter() {pque.push(v);}while !pque.is_empty() && a > 0 {let val = pque.pop().unwrap();if val > x {pque.push(val - x);}a -= 1;}let bsum = b * y;let summary = pque.iter().sum::<usize>();if bsum >= summary {println!("Yes");} else {println!("No");}}