結果

問題 No.9 モンスターのレベル上げ
ユーザー nisizawa
提出日時 2017-12-19 11:51:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,245 ms / 5,000 ms
コード長 465 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 82,100 KB
実行使用メモリ 88,508 KB
最終ジャッジ日時 2024-06-24 00:19:04
合計ジャッジ時間 12,956 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

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

ct_max_min = float('inf')
for i in range(n):
    hq = [(a, 0) for a in a_ls]
    heapq.heapify(hq)
    
    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)

    ct_max_min = min(ct_max_min, ct_max)

print(ct_max_min)
0