結果

問題 No.9 モンスターのレベル上げ
ユーザー norioc
提出日時 2024-08-28 03:40:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,334 ms / 5,000 ms
コード長 452 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 82,220 KB
実行使用メモリ 91,376 KB
最終ジャッジ日時 2024-08-28 03:40:36
合計ジャッジ時間 14,094 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop

INF = 1 << 60
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


def solve(p: int):
    q = []  # (レベル, 戦闘回数)
    for a in A:
        heappush(q, (a, 0))

    for b in B[p:] + B[:p]:
        lv, cnt = heappop(q)
        heappush(q, (lv+(b//2), cnt+1))

    return max(cnt for _, cnt in q)


ans = INF
for i in range(N):
    ans = min(ans, solve(i))

print(ans)
0