結果
問題 | No.1449 新プロランド |
ユーザー |
👑 ![]() |
提出日時 | 2021-05-19 13:18:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 300 ms / 2,000 ms |
コード長 | 624 bytes |
コンパイル時間 | 247 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 175,744 KB |
最終ジャッジ日時 | 2024-12-24 02:08:23 |
合計ジャッジ時間 | 3,886 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
from heapq import heapify,heappop,heappush N,M=map(int,input().split()) E=[[] for _ in range(N)] for _ in range(M): a,b,c=map(int,input().split()) a-=1; b-=1; E[a].append((b,c)) E[b].append((a,c)) T=list(map(int,input().split())) T_max=max(T) inf=float("inf") D=[[inf]*(T_max*10*(N-1)+1) for _ in range(N)] D[0][T[0]]=T[0] Q=[(T[0],0,T[0])] heapify(Q) while Q: d,x,t=heappop(Q) if x==N-1: break if D[x][t]<d: continue for b,c in E[x]: k=d+c//t+T[b] if k<D[b][t+T[b]]: D[b][t+T[b]]=k heappush(Q,(k,b,t+T[b])) print(min(D[-1]))