結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-03 21:59:41 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,404 bytes |
| コンパイル時間 | 13,255 ms |
| コンパイル使用メモリ | 403,476 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-03 02:40:58 |
| 合計ジャッジ時間 | 14,920 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 WA * 18 |
ソースコード
use std::io::*;
fn main() {
let mut s: String = String::new();
std::io::stdin().read_to_string(&mut s).ok();
let mut itr = s.trim().split_whitespace();
let n: usize = itr.next().unwrap().parse().unwrap();
let mut x: i64 = itr.next().unwrap().parse().unwrap();
let mut y: i64 = itr.next().unwrap().parse().unwrap();
let mut z: i64 = itr.next().unwrap().parse().unwrap();
let mut a: std::collections::BinaryHeap<i64> = (0..n)
.map(|_| itr.next().unwrap().parse().unwrap())
.collect();
while let Some(mut b) = a.pop() {
if b < 0 {
println!("Yes");
return;
} else if x == 0 && y == 0 && z == 0 {
println!("No");
return;
}
if x > 0 {
if b / 10000 + 1 <= x {
x -= b / 10000 + 1;
b = -1;
} else {
b -= x * 10000;
x = 0;
}
} else if y > 0 {
if b / 5000 + 1 <= y {
y -= b / 5000 + 1;
b = -1;
} else {
b -= y * 5000;
y = 0;
}
} else if z > 0 {
if b / 1000 + 1 <= z {
z -= b / 1000 + 1;
b = -1;
} else {
b -= z * 1000;
z = 0;
}
}
a.push(b);
}
}