結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー nisizawa
提出日時 2017-12-19 11:59:19
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 2,494 ms / 5,000 ms
コード長 539 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 352 ms
コンパイル使用メモリ 20,832 KB
実行使用メモリ 15,484 KB
最終ジャッジ日時 2026-03-09 07:32:56
合計ジャッジ時間 12,796 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import heapq

n = int(input())
a_ls = [int(a) for a in input().split()]
b_ls = [int(b) for b in input().split()]

hq_o = [(a, 0) for a in a_ls]
heapq.heapify(hq_o)

ct_max_min = float('inf')
for i in range(n):
    hq = hq_o[:]
    
    ct_max = 0
    for j in range(n):
        lv, ct = hq[0]
        lv += b_ls[(i + j) % n] // 2
        ct += 1
        heapq.heapreplace(hq, (lv, ct))
        ct_max = max(ct, ct_max)
        
        if ct_max >= ct_max_min:
            break

    ct_max_min = min(ct_max_min, ct_max)

print(ct_max_min)
0