結果
| 問題 |
No.1449 新プロランド
|
| コンテスト | |
| ユーザー |
sasa8uyauya
|
| 提出日時 | 2024-09-11 05:31:29 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 130 ms / 2,000 ms |
| コード長 | 637 bytes |
| コンパイル時間 | 344 ms |
| コンパイル使用メモリ | 82,408 KB |
| 実行使用メモリ | 77,888 KB |
| 最終ジャッジ日時 | 2024-09-11 05:31:32 |
| 合計ジャッジ時間 | 2,973 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
n,m=map(int,input().split())
e=[[] for i in range(n)]
for i in range(m):
a,b,c=map(int,input().split())
a-=1
b-=1
e[a]+=[(b,c)]
e[b]+=[(a,c)]
o=list(map(int,input().split()))
X=10**10
v=[[(X,X)]*1002 for i in range(n)]
v[0][1]=(0,0)
q=[(v[0][1],0,1)]
from heapq import heappush,heappop
while len(q)>0:
sc,sp,so=heappop(q)
if sc>v[sp][so]:
continue
if sp==n-1:
break
st1,st2=sc[0],-sc[1]
tt2=st2+o[sp]
to=so+1
for tp,tc in e[sp]:
tt1=st1+o[sp]+tc//tt2
if to<=1001 and v[tp][to]>(tt1,-tt2):
v[tp][to]=(tt1,-tt2)
heappush(q,(v[tp][to],tp,to))
print(min(v[n-1][i][0] for i in range(1002)))
sasa8uyauya