結果

問題 No.9 モンスターのレベル上げ
ユーザー chocoruskchocorusk
提出日時 2020-09-07 13:58:40
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 4,499 ms / 5,000 ms
コード長 353 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-11-29 10:41:01
合計ジャッジ時間 38,582 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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=que[0]
        heapq.heappushpop(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