結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー taba
提出日時 2024-07-30 17:24:39
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
WA  
実行時間 -
コード長 717 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,411 ms
コンパイル使用メモリ 210,124 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-04-03 19:11:45
合計ジャッジ時間 4,866 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused imports: `HashMap` and `HashSet`
 --> src/main.rs:1:34
  |
1 | use std::collections::{BTreeSet, HashMap, HashSet, VecDeque};
  |                                  ^^^^^^^  ^^^^^^^
  |
  = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default

warning: unused import: `proconio::marker::Chars`
 --> src/main.rs:3:5
  |
3 | use proconio::marker::Chars;
  |     ^^^^^^^^^^^^^^^^^^^^^^^

ソースコード

diff #
raw source code

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}");
}
0