結果
| 問題 |
No.1449 新プロランド
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-23 16:44:36 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 730 bytes |
| コンパイル時間 | 101 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-12-24 02:09:28 |
| 合計ジャッジ時間 | 2,680 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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]))