結果
問題 |
No.1 道のショートカット
|
ユーザー |
|
提出日時 | 2021-11-11 16:23:44 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 599 bytes |
コンパイル時間 | 229 ms |
コンパイル使用メモリ | 82,024 KB |
実行使用メモリ | 62,244 KB |
最終ジャッジ日時 | 2024-11-22 23:20:52 |
合計ジャッジ時間 | 3,377 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | AC * 4 WA * 36 |
ソースコード
import heapq N = int(input()) C = int(input()) V = int(input()) S = list(map(int,input().split())) T = list(map(int,input().split())) Y = list(map(int,input().split())) M = list(map(int,input().split())) G=[[] for _ in range(N)] for i in range(V): G[S[i]-1].append((M[i],Y[i],T[i]-1)) seen=[False]*N seen[0]=True hq=[(0,0,0)] heapq.heapify(hq) while(hq): t,c,v=heapq.heappop(hq) if seen[v]==1: continue seen[v]=1 if v==N-1: print(t) exit() for m,y,u in G[v]: if c+y<=C and seen[u]==False: heapq.heappush(hq,(t+m,c+y,u)) print(-1)