結果

問題 No.9 モンスターのレベル上げ
ユーザー nisizawanisizawa
提出日時 2017-12-19 11:50:38
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 3,904 ms / 5,000 ms
コード長 465 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 8,668 KB
最終ジャッジ日時 2023-09-06 05:39:12
合計ジャッジ時間 35,551 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,916 KB
testcase_01 AC 15 ms
8,036 KB
testcase_02 AC 3,523 ms
8,580 KB
testcase_03 AC 2,776 ms
8,504 KB
testcase_04 AC 1,468 ms
8,540 KB
testcase_05 AC 1,014 ms
8,484 KB
testcase_06 AC 363 ms
8,072 KB
testcase_07 AC 22 ms
7,940 KB
testcase_08 AC 473 ms
8,280 KB
testcase_09 AC 3,455 ms
8,500 KB
testcase_10 AC 16 ms
7,948 KB
testcase_11 AC 3,386 ms
8,356 KB
testcase_12 AC 3,904 ms
8,468 KB
testcase_13 AC 3,241 ms
8,448 KB
testcase_14 AC 3,485 ms
8,668 KB
testcase_15 AC 3,156 ms
8,496 KB
testcase_16 AC 74 ms
8,120 KB
testcase_17 AC 2,025 ms
8,564 KB
testcase_18 AC 1,695 ms
8,444 KB
testcase_19 AC 49 ms
7,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

n = int(input())
a_ls = [int(a) for a in input().split()]
b_ls = [int(b) for b in input().split()]

ct_max_min = float('inf')
for i in range(n):
    hq = [(a, 0) for a in a_ls]
    heapq.heapify(hq)
    
    ct_max = 0
    for j in range(n):
        lv, ct = hq[0]
        lv += b_ls[(i + j) % n] // 2
        ct += 1
        heapq.heapreplace(hq, (lv, ct))
        ct_max = max(ct, ct_max)

    ct_max_min = min(ct_max_min, ct_max)

print(ct_max_min)
0