結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー lloyz
提出日時 2023-09-28 03:03:36
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 758 ms / 5,000 ms
+ 529µs
コード長 549 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,007 ms
コンパイル使用メモリ 95,344 KB
実行使用メモリ 91,400 KB
最終ジャッジ日時 2026-08-20 16:29:07
合計ジャッジ時間 9,900 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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