結果

問題 No.9 モンスターのレベル上げ
ユーザー zimpha
提出日時 2017-12-07 01:29:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,495 ms / 5,000 ms
コード長 396 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 94,916 KB
最終ジャッジ日時 2024-06-24 00:18:00
合計ジャッジ時間 15,225 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ret = n
for i in range(n):
    pq = [(x, 0) for x in a]
    heapify(pq)
    mx = 0
    for j in range(n):
        e = b[(i + j) % n]
        u = heappop(pq)
        u = (u[0] + e // 2, u[1] + 1)
        heappush(pq, u)
    mx = max([e[1] for e in pq])
    ret = min(ret, mx)
print(ret)
0