結果
| 問題 | No.1736 Princess vs. Dragoness |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-13 09:28:53 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,067 bytes |
| 記録 | |
| コンパイル時間 | 13,051 ms |
| コンパイル使用メモリ | 389,764 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-26 22:17:44 |
| 合計ジャッジ時間 | 13,666 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 WA * 5 |
ソースコード
fn main() {
let v1: Vec<i64> = input_line();
let (n, mut a, b, x, y) = (v1[0] as usize, v1[1], v1[2], v1[3], v1[4]);
let mut hv: Vec<i64> = input_line();
hv.sort();
let mut idx_defeat = 0_usize;
let mut b_total = b * y;
while b > 0 && idx_defeat < n {
if b_total >= hv[idx_defeat] {
b_total -= hv[idx_defeat];
hv[idx_defeat] = 0;
idx_defeat += 1;
} else {
hv[idx_defeat] -= b_total;
break;
}
}
while a > 0 && idx_defeat < n {
while hv[idx_defeat] > 0 && a > 0 {
hv[idx_defeat] -= x;
a -= 1;
if hv[idx_defeat] < 0 {
idx_defeat += 1;
break;
}
}
}
println!("{}", if idx_defeat == n { "Yes" } else { "No" });
}
fn input_line<T: std::str::FromStr>() -> Vec<T> {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
s.trim()
.split_whitespace()
.map(|e| e.parse().ok().unwrap())
.collect()
}