結果
| 問題 | No.555 世界史のレポート |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-15 00:06:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 337 bytes |
| 記録 | |
| コンパイル時間 | 536 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 330,524 KB |
| 最終ジャッジ日時 | 2024-12-15 13:02:56 |
| 合計ジャッジ時間 | 21,023 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 TLE * 4 |
ソースコード
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 + v, num * 2, num))
heappush(H, (cost + v, num + c_num, c_num))