結果
| 問題 | No.1 道のショートカット |
| コンテスト | |
| ユーザー |
akasia_midori
|
| 提出日時 | 2022-05-03 10:46:11 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 795 bytes |
| 記録 | |
| コンパイル時間 | 167 ms |
| コンパイル使用メモリ | 85,504 KB |
| 実行使用メモリ | 855,968 KB |
| 最終ジャッジ日時 | 2026-03-23 20:53:32 |
| 合計ジャッジ時間 | 62,601 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 MLE * 2 |
| other | AC * 27 RE * 4 TLE * 9 |
ソースコード
def one_str():
return input()
def many_int():
return list(map(int, input().split()))
import heapq
input_count = 0
N = int(input())
C = int(input())
V = int(input())
S = many_int()
T = many_int()
Y = many_int()
M = many_int()
G = {i:[] for i in range(V)}
for i in range(V):
G[S[i]-1].append((T[i]-1, M[i], Y[i]))
q = [[0,0,0]]
mins = 10**10
while q:
all_minute, all_cost, now_node = heapq.heappop(q)
if now_node == (N-1):
mins = min(mins, all_minute)
continue
for next_node, next_minute, next_cost in G[now_node]:
if (all_cost + next_cost) > C:
continue
else:
heapq.heappush(q, (all_minute+next_minute, all_cost+next_cost, next_node))
if mins == 10**10:
print(-1)
else:
print(mins)
akasia_midori