結果

問題 No.1449 新プロランド
ユーザー 👑 KazunKazun
提出日時 2021-05-19 13:16:56
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 621 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 87,988 KB
最終ジャッジ日時 2023-08-25 16:53:16
合計ジャッジ時間 4,389 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,288 KB
testcase_01 AC 75 ms
71,168 KB
testcase_02 AC 80 ms
71,340 KB
testcase_03 RE -
testcase_04 AC 76 ms
71,328 KB
testcase_05 AC 128 ms
83,576 KB
testcase_06 AC 80 ms
75,388 KB
testcase_07 AC 81 ms
75,404 KB
testcase_08 AC 103 ms
83,892 KB
testcase_09 AC 78 ms
75,456 KB
testcase_10 AC 80 ms
75,588 KB
testcase_11 AC 78 ms
75,244 KB
testcase_12 AC 135 ms
81,964 KB
testcase_13 AC 82 ms
75,404 KB
testcase_14 AC 79 ms
75,624 KB
testcase_15 AC 78 ms
75,256 KB
testcase_16 AC 81 ms
75,248 KB
testcase_17 AC 92 ms
76,784 KB
testcase_18 AC 76 ms
71,288 KB
testcase_19 AC 77 ms
75,252 KB
testcase_20 AC 75 ms
71,492 KB
testcase_21 AC 79 ms
75,636 KB
testcase_22 AC 75 ms
71,376 KB
testcase_23 AC 80 ms
75,452 KB
testcase_24 AC 79 ms
75,480 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 203 ms
87,988 KB
testcase_28 AC 102 ms
76,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify,heappop,heappush

N,M=map(int,input().split())
E=[[] for _ in range(N)]
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))

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

inf=float("inf")
D=[[inf]*(T_max*(N-1)+1) 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]
        if k<D[b][t+T[b]]:
            D[b][t+T[b]]=k
            heappush(Q,(k,b,t+T[b]))

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