結果

問題 No.1473 おでぶなおばけさん
ユーザー lloyzlloyz
提出日時 2022-08-11 22:18:05
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,380 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 82,456 KB
実行使用メモリ 848,916 KB
最終ジャッジ日時 2024-09-22 05:15:34
合計ジャッジ時間 17,578 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,544 KB
testcase_01 AC 41 ms
54,868 KB
testcase_02 AC 657 ms
100,980 KB
testcase_03 AC 321 ms
98,504 KB
testcase_04 AC 329 ms
89,908 KB
testcase_05 AC 170 ms
79,792 KB
testcase_06 AC 501 ms
95,776 KB
testcase_07 AC 494 ms
102,060 KB
testcase_08 AC 817 ms
102,188 KB
testcase_09 AC 480 ms
103,480 KB
testcase_10 AC 152 ms
83,792 KB
testcase_11 AC 259 ms
83,816 KB
testcase_12 AC 126 ms
83,888 KB
testcase_13 AC 124 ms
82,064 KB
testcase_14 AC 91 ms
80,100 KB
testcase_15 AC 177 ms
83,856 KB
testcase_16 AC 122 ms
82,736 KB
testcase_17 AC 62 ms
72,320 KB
testcase_18 AC 80 ms
77,344 KB
testcase_19 AC 174 ms
84,216 KB
testcase_20 AC 287 ms
97,064 KB
testcase_21 AC 404 ms
92,040 KB
testcase_22 AC 217 ms
105,980 KB
testcase_23 AC 190 ms
105,640 KB
testcase_24 AC 190 ms
101,780 KB
testcase_25 AC 623 ms
99,756 KB
testcase_26 AC 282 ms
99,004 KB
testcase_27 AC 227 ms
83,680 KB
testcase_28 AC 413 ms
103,296 KB
testcase_29 AC 390 ms
95,332 KB
testcase_30 AC 537 ms
98,504 KB
testcase_31 AC 420 ms
108,472 KB
testcase_32 AC 351 ms
101,628 KB
testcase_33 AC 257 ms
95,284 KB
testcase_34 AC 143 ms
86,900 KB
testcase_35 AC 169 ms
87,856 KB
testcase_36 AC 497 ms
91,072 KB
testcase_37 AC 227 ms
99,884 KB
testcase_38 AC 86 ms
78,128 KB
testcase_39 AC 119 ms
82,740 KB
testcase_40 AC 121 ms
82,672 KB
testcase_41 AC 160 ms
89,132 KB
testcase_42 AC 119 ms
88,616 KB
testcase_43 MLE -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
import sys
input = sys.stdin.readline

def main():
    n, m = map(int, input().split())
    edge = [[] for _ in range(n)]
    for _ in range(m):
        s, t, d = map(int, input().split())
        s -= 1
        t -= 1
        edge[s].append((t, d))
        edge[t].append((s, d))

    left, right = 1, 10**9 + 10
    while right - left > 1:
        mid = (left + right) // 2
        flag = False
        Que = deque([0])
        C = [10**18 for _ in range(n)]
        C[0] = 0
        while Que:
            cp = Que.popleft()
            if cp == n - 1:
                break
            cnt = C[cp]
            for np, w in edge[cp]:
                if w < mid:
                    continue
                if cnt + 1 > C[np]:
                    continue
                C[np] = cnt + 1
                Que.append(np)
        if C[n - 1] < 10**18:
            left = mid
        else:
            right = mid

    Que = deque([0])
    C = [10**18 for _ in range(n)]
    C[0] = 0
    while Que:
        cp = Que.popleft()
        if cp == n - 1:
            print(left, C[cp])
            break
        cnt = C[cp]
        for np, w in edge[cp]:
            if w < left:
                continue
            if cnt + 1 > C[np]:
                continue
            C[np] = cnt + 1
            Que.append(np)

if __name__ == '__main__':
    main()
0