結果

問題 No.9 モンスターのレベル上げ
ユーザー lloyz
提出日時 2023-09-28 03:03:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 910 ms / 5,000 ms
コード長 549 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 84,928 KB
最終ジャッジ日時 2024-07-20 21:42:08
合計ジャッジ時間 9,996 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop, heappush
import sys
input = sys.stdin.readline

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

H = []
for i in range(n):
    H.append((A[i], 0))
heapify(H)
ans = 10**18
for i in range(n):
    Hc = H[:]
    for j in range(n):
        ii = (i + j) % n
        cl, cc = heappop(Hc)
        cc += 1
        cl += B[ii] // 2
        heappush(Hc, (cl, cc))
    res = 0
    for j in range(n):
        cc = Hc[j][1]
        res = max(res, cc)
    ans = min(ans, res)
print(ans)
0