結果

問題 No.9 モンスターのレベル上げ
ユーザー szkhtsszkhts
提出日時 2022-04-16 08:21:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,943 ms / 5,000 ms
コード長 470 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-08-26 16:00:57
合計ジャッジ時間 34,216 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
8,020 KB
testcase_01 AC 14 ms
8,136 KB
testcase_02 AC 3,390 ms
8,564 KB
testcase_03 AC 2,600 ms
8,644 KB
testcase_04 AC 1,426 ms
8,496 KB
testcase_05 AC 948 ms
8,448 KB
testcase_06 AC 350 ms
8,140 KB
testcase_07 AC 21 ms
8,108 KB
testcase_08 AC 447 ms
8,048 KB
testcase_09 AC 3,256 ms
8,752 KB
testcase_10 AC 15 ms
8,004 KB
testcase_11 AC 3,123 ms
8,752 KB
testcase_12 AC 3,943 ms
8,464 KB
testcase_13 AC 3,000 ms
8,580 KB
testcase_14 AC 3,301 ms
8,620 KB
testcase_15 AC 3,017 ms
8,664 KB
testcase_16 AC 65 ms
7,976 KB
testcase_17 AC 1,954 ms
8,540 KB
testcase_18 AC 1,641 ms
8,428 KB
testcase_19 AC 46 ms
8,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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