結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー szkhts
提出日時 2022-04-16 08:21:31
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 2,604 ms / 5,000 ms
+ 824µs
コード長 470 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 58 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2026-10-07 19:17:15
合計ジャッジ時間 25,249 ms
ジャッジサーバーID
(参考情報)
judge4_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import heapq
from types import LambdaType

n = int(input())

allies = list(map(int, input().split()))
enemies = list(map(lambda x: int(x) // 2, input().split()))

ans = n + 1

for s in range(n):
    que = [(allies[i], 0) for i in range(n)]
    heapq.heapify(que)
    temp = 0
    for j in range(n):
        u = heapq.heappop(que)
        heapq.heappush(que, (u[0] + enemies[(s + j) % n], u[1] + 1))
        temp = max(temp, u[1] + 1)
    ans = min(ans, temp)

print(ans)
0