結果

問題 No.9 モンスターのレベル上げ
ユーザー 👑 rin204
提出日時 2022-06-12 15:51:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,173 ms / 5,000 ms
コード長 419 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,104 KB
実行使用メモリ 89,040 KB
最終ジャッジ日時 2024-09-23 04:04:25
合計ジャッジ時間 12,477 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort()
ans = 1 << 30
for i in range(n):
    hq = [(a, 0) for a in A]
    max_ = 0
    for j in range(i, i + n):
        if j >= n:
            j -= n
        a, t = heappop(hq)
        t += 1
        a += B[j] // 2
        max_ = max(max_, t)
        heappush(hq, (a, t))
    ans = min(ans, max_)
print(ans)
0