結果
| 問題 | No.1 道のショートカット |
| コンテスト | |
| ユーザー |
ikatakos
|
| 提出日時 | 2016-11-15 21:23:53 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
TLE
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 568 bytes |
| 記録 | |
| コンパイル時間 | 56 ms |
| コンパイル使用メモリ | 15,232 KB |
| 実行使用メモリ | 157,952 KB |
| 最終ジャッジ日時 | 2026-10-11 16:18:26 |
| 合計ジャッジ時間 | 9,668 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 TLE * 1 -- * 26 |
ソースコード
from heapq import heapify, heappush, heappop
n, c, v = map(int, (input() for _ in range(3)))
connections = [set() for _ in range(n + 1)]
for s, t, y, m in zip(*(map(int, input().split()) for _ in range(4))):
connections[s].add((m, t, y))
queue = [(*con, c - con[2]) for con in connections[1] if con[2] <= c]
heapify(queue)
while queue:
m, t, y, c = heappop(queue)
if t == n:
print(m)
break
for nm, nt, ny in connections[t]:
if c < ny:
continue
heappush(queue, (m + nm, nt, ny, c - ny))
else:
print(-1)
ikatakos