結果

問題 No.9 モンスターのレベル上げ
ユーザー Hydru
提出日時 2023-01-16 14:13:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,598 ms / 5,000 ms
コード長 392 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 92,684 KB
最終ジャッジ日時 2024-12-30 21:38:53
合計ジャッジ時間 16,975 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

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

from heapq import heapify,heappop,heappush

inf=float("inf")
ans=inf
for i in range(n):
    Q=[(A[j],0) for j in range(n)]
    heapify(Q)
    max_cnt=0
    for j in range(n):
        a,c=heappop(Q)
        max_cnt=max(max_cnt,c+1)
        heappush(Q,(a+B[(i+j)%n]//2,c+1))
    ans=min(ans,max_cnt)

print(ans)
0