結果
問題 |
No.1449 新プロランド
|
ユーザー |
|
提出日時 | 2022-02-23 16:45:37 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 730 bytes |
コンパイル時間 | 313 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 78,308 KB |
最終ジャッジ日時 | 2024-12-24 02:09:25 |
合計ジャッジ時間 | 5,005 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 WA * 1 |
ソースコード
import heapq n,m=map(int,input().split()) g=[[] for _ in range(n)] for _ in range(m): a,b,c=map(int,input().split()) g[a-1].append((b-1,c)) g[b-1].append((a-1,c)) t=list(map(int,input().split())) time=[[float('inf')]*501 for _ in range(n)] time[0][0]=0 q=[(0,0,0)] while q: now_time,now_place,eat_time=heapq.heappop(q) if time[now_place][eat_time]<now_time: continue now_time+=t[now_place] eat_time=min(eat_time+t[now_place],500) for to_place,to_dst in g[now_place]: if time[to_place][eat_time]>now_time+to_dst//eat_time: time[to_place][eat_time]=now_time+to_dst//eat_time heapq.heappush(q,(now_time+to_dst//eat_time,to_place,eat_time)) print(min(time[n-1]))