結果

問題 No.1473 おでぶなおばけさん
ユーザー c-yanc-yan
提出日時 2021-04-09 22:50:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 671 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 279,624 KB
最終ジャッジ日時 2023-09-07 12:28:04
合計ジャッジ時間 19,861 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,784 KB
testcase_01 AC 88 ms
71,760 KB
testcase_02 AC 479 ms
96,524 KB
testcase_03 WA -
testcase_04 AC 235 ms
87,504 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 295 ms
94,304 KB
testcase_08 WA -
testcase_09 AC 268 ms
94,264 KB
testcase_10 AC 205 ms
85,964 KB
testcase_11 WA -
testcase_12 AC 200 ms
85,772 KB
testcase_13 AC 176 ms
82,376 KB
testcase_14 AC 146 ms
79,476 KB
testcase_15 AC 184 ms
82,284 KB
testcase_16 AC 173 ms
84,564 KB
testcase_17 AC 118 ms
77,584 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 425 ms
90,468 KB
testcase_22 AC 266 ms
92,288 KB
testcase_23 AC 231 ms
89,192 KB
testcase_24 AC 220 ms
88,464 KB
testcase_25 AC 250 ms
90,748 KB
testcase_26 AC 255 ms
90,460 KB
testcase_27 AC 164 ms
80,728 KB
testcase_28 AC 308 ms
94,424 KB
testcase_29 AC 441 ms
91,972 KB
testcase_30 AC 577 ms
95,964 KB
testcase_31 AC 329 ms
96,512 KB
testcase_32 WA -
testcase_33 AC 480 ms
95,564 KB
testcase_34 AC 245 ms
85,404 KB
testcase_35 AC 285 ms
85,000 KB
testcase_36 AC 210 ms
85,188 KB
testcase_37 AC 220 ms
88,620 KB
testcase_38 AC 125 ms
77,928 KB
testcase_39 AC 179 ms
84,724 KB
testcase_40 AC 180 ms
84,680 KB
testcase_41 AC 171 ms
87,880 KB
testcase_42 AC 170 ms
87,784 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, -1)
while q:
    cp, mw = q.popleft()
    for np, lw in links[cp]:
        w = dp[np][0]
        nw = min(mw, lw)
        if w >= nw:
            continue
        dp[np] = (nw, cp)
        q.append((np, nw))

c = 0
cp = n - 1
while cp != 0:
    cp = dp[cp][1]
    c += 1
print(dp[n - 1][0], c)
0