結果

問題 No.9 モンスターのレベル上げ
ユーザー tabataba
提出日時 2024-07-30 17:24:39
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 717 bytes
コンパイル時間 14,152 ms
コンパイル使用メモリ 390,596 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-30 17:24:59
合計ジャッジ時間 19,451 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 AC 494 ms
6,816 KB
testcase_03 WA -
testcase_04 AC 204 ms
6,944 KB
testcase_05 AC 133 ms
6,940 KB
testcase_06 AC 45 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 61 ms
6,944 KB
testcase_09 AC 483 ms
6,940 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 395 ms
6,944 KB
testcase_12 AC 193 ms
6,944 KB
testcase_13 WA -
testcase_14 AC 482 ms
6,944 KB
testcase_15 AC 445 ms
6,940 KB
testcase_16 WA -
testcase_17 AC 280 ms
6,940 KB
testcase_18 AC 235 ms
6,944 KB
testcase_19 AC 5 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
  |     ^^^^^^^^^^^^^^^^^^^^^^^

ソースコード

diff #

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