結果

問題 No.9 モンスターのレベル上げ
ユーザー szkhtsszkhts
提出日時 2020-09-25 16:52:38
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 4,018 ms / 5,000 ms
コード長 566 bytes
コンパイル時間 708 ms
使用メモリ 8,192 KB
最終ジャッジ日時 2023-01-27 20:37:13
合計ジャッジ時間 36,582 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 16 ms
7,828 KB
testcase_01 AC 16 ms
7,804 KB
testcase_02 AC 3,613 ms
8,004 KB
testcase_03 AC 2,790 ms
8,152 KB
testcase_04 AC 1,533 ms
8,040 KB
testcase_05 AC 1,026 ms
8,036 KB
testcase_06 AC 373 ms
7,948 KB
testcase_07 AC 23 ms
7,660 KB
testcase_08 AC 479 ms
7,860 KB
testcase_09 AC 3,515 ms
8,044 KB
testcase_10 AC 16 ms
7,664 KB
testcase_11 AC 3,353 ms
8,116 KB
testcase_12 AC 4,018 ms
8,124 KB
testcase_13 AC 3,158 ms
8,192 KB
testcase_14 AC 3,474 ms
8,044 KB
testcase_15 AC 3,222 ms
8,096 KB
testcase_16 AC 73 ms
7,708 KB
testcase_17 AC 2,081 ms
8,036 KB
testcase_18 AC 1,732 ms
8,012 KB
testcase_19 AC 50 ms
7,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

N = int(input())
parties = list(map(int, input().split()))
monsters = list(map(int, input().split()))
monsters = monsters + monsters

result = N

for i in range(N):
    k = i
    battles = [(x, 0) for x in parties]
    heapq.heapify(battles)
    for j in range(N):
        idx = battles[0]
        heapq.heappushpop(battles, (idx[0] + monsters[k] // 2, idx[1] + 1))
        k += 1
        if k >= N:
            k = 0
    maximum = 0
    for battle in battles:
        maximum = max(maximum, battle[1])
    result = min(result, maximum)

print(result)
0