結果
問題 | No.1015 おつりは要らないです |
ユーザー |
![]() |
提出日時 | 2020-04-03 23:43:52 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,414 bytes |
コンパイル時間 | 11,973 ms |
コンパイル使用メモリ | 379,684 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-03 06:33:11 |
合計ジャッジ時間 | 13,698 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 WA * 12 |
ソースコード
use std::cmp::min; //{{{ #[allow(unused_macros)] macro_rules! getl { ( $( $t:ty ),* ) => { { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); let s = s.trim_end(); let mut ws = s.split_whitespace(); ($(ws.next().unwrap().parse::<$t>().unwrap()),*) } }; } #[allow(unused_macros)] macro_rules! getl_vec { ( $t:ty ) => { { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); let s = s.trim_end(); s.split_whitespace().map(|x| x.parse().unwrap()).collect::<Vec<$t>>() } }; } //}}} fn main() { let (n, x, y, z) = getl!(usize, i64, i64, i64); let mut a = getl_vec!(i64); for i in 0..n { a[i] += 1; } let mut z = z; for i in 0..n { let q = min(a[i] / 10000, z); z -= q; a[i] -= 10000 * q; } let mut y = y; for i in 0..n { let q = min(a[i] / 5000, y); y -= q; a[i] -= 5000 * q; } a.sort(); a.reverse(); let mut x = x; for i in 0..n { if z > 0 { z -= 1; } else if y > 0 { y -= 1; } else { let q = (a[i] + 1000 - 1) / 1000; x -= q; } } if x >= 0 { println!("Yes"); } else { println!("No"); } }