結果

問題 No.555 世界史のレポート
ユーザー lloyzlloyz
提出日時 2022-09-15 00:04:25
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 329 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 282,532 KB
最終ジャッジ日時 2023-08-21 21:33:20
合計ジャッジ時間 6,217 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,352 KB
testcase_01 AC 75 ms
71,252 KB
testcase_02 AC 75 ms
71,200 KB
testcase_03 AC 119 ms
77,528 KB
testcase_04 AC 129 ms
77,724 KB
testcase_05 AC 130 ms
77,600 KB
testcase_06 AC 127 ms
77,764 KB
testcase_07 AC 135 ms
77,720 KB
testcase_08 AC 133 ms
77,488 KB
testcase_09 AC 140 ms
77,796 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop, heappush

n = int(input())
c, v = map(int, input().split())

H = [(c, 1, 1)]
heapify(H)
while H:
    cost, num, c_num = heappop(H)
    if num >= n:
        print(cost)
        break
    if c_num != num:
        heappush(H, (cost + c, num, num))
    heappush(H, (cost + v, num + c_num, c_num))
0