結果
| 問題 | No.1449 新プロランド |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-31 21:38:29 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 555 bytes |
| 記録 | |
| コンパイル時間 | 172 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 53,248 KB |
| 最終ジャッジ日時 | 2026-05-29 22:20:53 |
| 合計ジャッジ時間 | 5,709 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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])