結果
| 問題 | No.555 世界史のレポート |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2026-01-02 02:54:15 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 147 ms / 2,000 ms |
| コード長 | 362 bytes |
| 記録 | |
| コンパイル時間 | 304 ms |
| コンパイル使用メモリ | 82,576 KB |
| 実行使用メモリ | 79,300 KB |
| 最終ジャッジ日時 | 2026-01-02 02:54:23 |
| 合計ジャッジ時間 | 3,544 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
from heapq import heappush, heappop
INF = 1 << 62
N = int(input())
C, V = map(int, input().split())
q = [(C, 1, 1)]
used = set()
while q:
cost, n, cb = heappop(q)
if n >= N:
print(cost)
break
if (n, cb) in used: continue
used.add((n, cb))
heappush(q, (cost+V, n+cb, cb))
if n > cb:
heappush(q, (cost+C, n, n))
norioc