結果
| 問題 |
No.1736 Princess vs. Dragoness
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-29 23:18:11 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 928 bytes |
| コンパイル時間 | 11,421 ms |
| コンパイル使用メモリ | 397,420 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-07-04 14:07:11 |
| 合計ジャッジ時間 | 12,349 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
コンパイルメッセージ
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");
}
}