結果

問題 No.9 モンスターのレベル上げ
ユーザー chocorusk
提出日時 2020-09-07 13:52:43
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 4,353 ms / 5,000 ms
コード長 362 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-11-29 10:38:47
合計ジャッジ時間 39,972 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
b=b+b
import heapq
ans=n
for i in range(n):
    que=[[x, 0] for x in a]
    heapq.heapify(que)
    for x in b[i:i+n]:
        p=heapq.heappop(que)
        heapq.heappush(que, [p[0]+x//2, p[1]+1])
    mx=0
    for p in que:
        mx=max(mx, p[1])
    ans=min(ans, mx)
print(ans)
0