結果

問題 No.1449 新プロランド
コンテスト
ユーザー 👑 Kazun
提出日時 2021-05-19 13:21:07
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 663 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 94 ms
コンパイル使用メモリ 64,640 KB
実行使用メモリ 63,488 KB
最終ジャッジ日時 2026-10-18 00:33:55
合計ジャッジ時間 3,174 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge6_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from heapq import heapify,heappop,heappush

N,M=map(int,input().split())
E=[[] for _ in range(N)]
C_max=0

for _ in range(M):
    a,b,c=map(int,input().split())
    a-=1; b-=1;

    E[a].append((b,c))
    E[b].append((a,c))

    C_max=max(C_max,c)

T=list(map(int,input().split()))
T_max=max(T)

inf=float("inf")
D=[[inf]*(C_max+2) for _ in range(N)]

D[0][T[0]]=T[0]
Q=[(T[0],0,T[0])]
heapify(Q)

while Q:
    d,x,t=heappop(Q)

    if x==N-1:
        break

    if D[x][t]<d:
        continue

    for b,c in E[x]:
        k=d+c//t+T[b]
        u=min(C_max+1,t+T[b])
        if k<D[b][u]:
            D[b][u]=k
            heappush(Q,(k,b,u))

print(min(D[-1]))
0