結果

問題 No.1473 おでぶなおばけさん
ユーザー c-yanc-yan
提出日時 2021-04-09 22:56:17
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 716 bytes
コンパイル時間 1,149 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 108,680 KB
最終ジャッジ日時 2023-09-07 12:35:33
合計ジャッジ時間 19,801 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
75,880 KB
testcase_01 AC 95 ms
71,724 KB
testcase_02 AC 536 ms
96,384 KB
testcase_03 AC 770 ms
100,592 KB
testcase_04 AC 247 ms
87,200 KB
testcase_05 AC 186 ms
81,552 KB
testcase_06 AC 887 ms
103,176 KB
testcase_07 AC 322 ms
94,280 KB
testcase_08 AC 317 ms
94,292 KB
testcase_09 AC 296 ms
94,384 KB
testcase_10 AC 210 ms
85,780 KB
testcase_11 AC 221 ms
85,808 KB
testcase_12 AC 210 ms
86,044 KB
testcase_13 AC 168 ms
82,004 KB
testcase_14 AC 149 ms
79,684 KB
testcase_15 AC 194 ms
81,980 KB
testcase_16 AC 182 ms
84,544 KB
testcase_17 AC 116 ms
77,864 KB
testcase_18 AC 119 ms
77,584 KB
testcase_19 AC 355 ms
86,188 KB
testcase_20 AC 580 ms
96,204 KB
testcase_21 AC 441 ms
90,784 KB
testcase_22 AC 286 ms
92,308 KB
testcase_23 AC 241 ms
89,584 KB
testcase_24 AC 241 ms
88,400 KB
testcase_25 AC 280 ms
90,736 KB
testcase_26 AC 266 ms
90,700 KB
testcase_27 AC 158 ms
80,672 KB
testcase_28 AC 347 ms
94,564 KB
testcase_29 AC 508 ms
92,116 KB
testcase_30 AC 622 ms
96,012 KB
testcase_31 AC 373 ms
96,440 KB
testcase_32 AC 905 ms
104,260 KB
testcase_33 AC 518 ms
95,540 KB
testcase_34 AC 253 ms
85,776 KB
testcase_35 AC 275 ms
84,496 KB
testcase_36 AC 208 ms
85,184 KB
testcase_37 AC 238 ms
88,804 KB
testcase_38 AC 128 ms
77,772 KB
testcase_39 AC 173 ms
84,760 KB
testcase_40 AC 183 ms
84,908 KB
testcase_41 AC 167 ms
87,988 KB
testcase_42 AC 173 ms
87,932 KB
testcase_43 TLE -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
from sys import stdin

readline = stdin.readline

INF = 10 ** 18

n, m = map(int, readline().split())

links = [[] for _ in range(n)]
for _ in range(m):
    s, t, d = map(int, readline().split())
    s, t = s - 1, t - 1
    links[s].append((t, d))
    links[t].append((s, d))

q = deque([(0, INF)])
dp = [(-1, -1) for _ in range(n)]
dp[0] = (INF, 0)
while q:
    cp, mw = q.popleft()
    for np, lw in links[cp]:
        w, s = dp[np]
        nw = min(mw, lw)
        if w >= nw:
            continue
        if w == nw:
            dp[np] = (nw, min(s, dp[cp][1] + 1))
        else:
            dp[np] = (nw, dp[cp][1] + 1)
        q.append((np, nw))
print(dp[n - 1][0], dp[n - 1][1])
0