結果
問題 |
No.9 モンスターのレベル上げ
|
ユーザー |
|
提出日時 | 2024-07-30 17:24:39 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 717 bytes |
コンパイル時間 | 14,152 ms |
コンパイル使用メモリ | 390,596 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-30 17:24:59 |
合計ジャッジ時間 | 19,451 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 3 |
コンパイルメッセージ
warning: unused imports: `HashMap`, `HashSet` --> src/main.rs:1:34 | 1 | use std::collections::{BTreeSet, HashMap, HashSet, VecDeque}; | ^^^^^^^ ^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused import: `proconio::marker::Chars` --> src/main.rs:3:5 | 3 | use proconio::marker::Chars; | ^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
use std::collections::{BTreeSet, HashMap, HashSet, VecDeque}; use proconio::marker::Chars; fn main() { proconio::input! { n: u32, mut a: [i32;n], b: [i32;n], } let mut min_b = i32::MAX; let mut b = VecDeque::from_iter(b); for _ in 0..n { let mut bts = a.iter().copied().map(|l| (l, 0)).collect::<BTreeSet<_>>(); for b in b.iter() { let mut a = bts.pop_first().unwrap(); a.0 += b / 2; a.1 += 1; bts.insert(a); } min_b = std::cmp::min(min_b, bts.iter().map(|&(_, b)| b).max().unwrap()); let temp = b.pop_front().unwrap(); b.push_back(temp); } println!("{min_b}"); }