結果
| 問題 |
No.1449 新プロランド
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-31 21:38:29 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 555 bytes |
| コンパイル時間 | 388 ms |
| コンパイル使用メモリ | 82,440 KB |
| 実行使用メモリ | 54,800 KB |
| 最終ジャッジ日時 | 2024-12-24 02:01:06 |
| 合計ジャッジ時間 | 2,578 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 WA * 4 |
ソースコード
from heapq import heappush, heappop
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].append((b,c))
e[b].append((a,c))
T = list(map(int,input().split()))
inf = 10**10
dis = [inf]*n
h = [(0,0,0)]
while h:
d,p,now = heappop(h)
p *= -1
if dis[now] <= d:
continue
dis[now] = d
p += T[now]
for nex,c in e[now]:
if dis[nex] > dis[now]+T[now]+c//p:
heappush(h, (dis[now]+T[now]+c//p,-p,nex))
print(dis[-1])