結果
| 問題 | No.1 道のショートカット |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-08-26 01:59:04 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
TLE
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 711 bytes |
| 記録 | |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 150,784 KB |
| 最終ジャッジ日時 | 2026-10-11 16:47:00 |
| 合計ジャッジ時間 | 9,879 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge4_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 TLE * 1 -- * 26 |
ソースコード
import heapq as pq
def read_int(): return int(input())
def read_int_list(): return list(map(int, input().split()))
N = read_int()
C = read_int()
V = read_int()
S = read_int_list()
T = read_int_list()
Y = read_int_list()
M = read_int_list()
way_from = {}
way_from = [set() for i in range(N + 1)]
for i in range(V):
way_from[S[i]].add((T[i], Y[i], M[i]))
heap = [(0, 1, 0)]
res = -1
while heap:
time, pos, cost = pq.heappop(heap)
if pos == N:
res = time
break
for next_pos, way_cost, way_time in way_from[pos]:
next_cost = cost + way_cost
if C < next_cost:
continue
pq.heappush(heap, (time + way_time, next_pos, next_cost))
print(res)