結果

問題 No.1449 新プロランド
ユーザー lloyzlloyz
提出日時 2022-08-21 14:51:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 588 bytes
コンパイル時間 625 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 205,704 KB
最終ジャッジ日時 2023-08-25 16:54:02
合計ジャッジ時間 4,330 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,820 KB
testcase_01 AC 91 ms
71,644 KB
testcase_02 AC 96 ms
71,796 KB
testcase_03 AC 147 ms
79,004 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop, heappush
from collections import defaultdict

n, m = map(int, input().split())
edge = defaultdict(list)
max_c = 0
for _ in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    max_c = max(max_c, c)
    edge[a].append((b, c))
    edge[b].append((a, c))
T = list(map(int, input().split()))

H = [(T[0], T[0], 0)]
heapify(H)
while H:
    t, et, cp = heappop(H)
    if cp == n - 1:
        print(t)
        break
    for np, tt in edge[cp]:
        nt = t + tt // et
        heappush(H, (nt + T[np], min(et + T[np], max_c + 1), np))
0