結果

問題 No.9 モンスターのレベル上げ
ユーザー AEn
提出日時 2022-12-15 01:32:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,350 ms / 5,000 ms
コード長 418 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 92,584 KB
最終ジャッジ日時 2024-11-08 18:08:07
合計ジャッジ時間 14,291 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

res = float('inf')
for i in range(N):
    h = []
    cnt = 0
    for j in range(N):
        heappush(h,(A[j],0))
    for j in range(N):
        b = B[(i+j)%N]
        lev, num = heappop(h)
        cnt = max(cnt,num+1)
        heappush(h,(lev+b//2,num+1))
    res = min(res, cnt)
print(res)

0