結果

問題 No.9 モンスターのレベル上げ
ユーザー nisizawanisizawa
提出日時 2017-12-19 11:50:38
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 3,939 ms / 5,000 ms
コード長 465 bytes
コンパイル時間 58 ms
使用メモリ 8,240 KB
最終ジャッジ日時 2023-01-21 16:58:38
合計ジャッジ時間 35,778 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 15 ms
7,756 KB
testcase_01 AC 15 ms
7,764 KB
testcase_02 AC 3,536 ms
8,076 KB
testcase_03 AC 2,757 ms
8,128 KB
testcase_04 AC 1,491 ms
8,044 KB
testcase_05 AC 1,006 ms
7,924 KB
testcase_06 AC 362 ms
7,840 KB
testcase_07 AC 22 ms
7,736 KB
testcase_08 AC 485 ms
7,828 KB
testcase_09 AC 3,427 ms
8,132 KB
testcase_10 AC 15 ms
7,708 KB
testcase_11 AC 3,328 ms
8,024 KB
testcase_12 AC 3,939 ms
8,092 KB
testcase_13 AC 3,172 ms
8,084 KB
testcase_14 AC 3,402 ms
8,184 KB
testcase_15 AC 3,241 ms
8,240 KB
testcase_16 AC 72 ms
7,680 KB
testcase_17 AC 2,052 ms
8,076 KB
testcase_18 AC 1,714 ms
7,996 KB
testcase_19 AC 49 ms
7,892 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