結果

問題 No.9 モンスターのレベル上げ
ユーザー szkhtsszkhts
提出日時 2020-09-25 16:52:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,926 ms / 5,000 ms
コード長 566 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 10,876 KB
実行使用メモリ 8,684 KB
最終ジャッジ日時 2023-09-10 14:34:04
合計ジャッジ時間 35,861 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,972 KB
testcase_01 AC 16 ms
7,948 KB
testcase_02 AC 3,532 ms
8,684 KB
testcase_03 AC 2,808 ms
8,620 KB
testcase_04 AC 1,491 ms
8,560 KB
testcase_05 AC 1,011 ms
8,576 KB
testcase_06 AC 364 ms
8,032 KB
testcase_07 AC 23 ms
8,020 KB
testcase_08 AC 478 ms
8,092 KB
testcase_09 AC 3,440 ms
8,648 KB
testcase_10 AC 16 ms
8,168 KB
testcase_11 AC 3,326 ms
8,452 KB
testcase_12 AC 3,926 ms
8,676 KB
testcase_13 AC 3,177 ms
8,608 KB
testcase_14 AC 3,398 ms
8,496 KB
testcase_15 AC 3,119 ms
8,524 KB
testcase_16 AC 74 ms
8,040 KB
testcase_17 AC 2,029 ms
8,608 KB
testcase_18 AC 1,683 ms
8,556 KB
testcase_19 AC 49 ms
8,112 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