結果

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

ソースコード

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,j) for j in range(n)]
    heapify(Q)
    cnt=[0 for _ in range(n)]
    for j in range(n):
        a,c,ind=heappop(Q)
        lv=B[(i+j)%n]//2
        cnt[ind]+=1
        heappush(Q,(a+lv,c+1,ind))
    ans=min(ans,max(cnt))

print(ans)
0