結果

問題 No.9 モンスターのレベル上げ
ユーザー tonyu0tonyu0
提出日時 2019-12-15 21:27:56
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 929 bytes
コンパイル時間 4,243 ms
コンパイル使用メモリ 144,840 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-15 15:43:46
合計ジャッジ時間 7,139 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 180 ms
4,380 KB
testcase_12 AC 208 ms
4,380 KB
testcase_13 AC 132 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;

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 a: Vec<i32> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();
    let b: Vec<i32> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    let mut ans: i32 = 0;
    for i in 0..n {
        let mut pq = std::collections::BinaryHeap::new();
        for j in 0..n {
            pq.push((-a[j], 0))
        }
        for j in 0..n {
            let (mut level, mut count) = pq.pop().unwrap();
            level *= -1;
            count *= -1;
            level += b[(i + j) % n] / 2;
            count += 1;
            ans = std::cmp::max(ans, count);
            pq.push((-level, -count));
        }
    }
    println!("{}", ans);
}
0