結果
問題 |
No.1449 新プロランド
|
ユーザー |
|
提出日時 | 2022-02-23 16:42:41 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 732 bytes |
コンパイル時間 | 141 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 13,440 KB |
最終ジャッジ日時 | 2024-12-24 02:09:08 |
合計ジャッジ時間 | 4,172 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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')]*1001 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],1000) 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]))