結果

問題 No.1473 おでぶなおばけさん
ユーザー lloyzlloyz
提出日時 2022-08-11 22:19:39
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,385 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 82,224 KB
実行使用メモリ 855,984 KB
最終ジャッジ日時 2024-09-22 05:16:32
合計ジャッジ時間 18,824 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,712 KB
testcase_01 AC 44 ms
55,528 KB
testcase_02 AC 747 ms
101,456 KB
testcase_03 AC 351 ms
98,376 KB
testcase_04 AC 354 ms
90,148 KB
testcase_05 AC 177 ms
79,796 KB
testcase_06 AC 612 ms
95,904 KB
testcase_07 AC 596 ms
102,320 KB
testcase_08 AC 966 ms
102,452 KB
testcase_09 AC 553 ms
103,608 KB
testcase_10 AC 154 ms
83,464 KB
testcase_11 AC 268 ms
83,572 KB
testcase_12 AC 129 ms
83,376 KB
testcase_13 AC 129 ms
82,196 KB
testcase_14 AC 89 ms
79,796 KB
testcase_15 AC 179 ms
83,816 KB
testcase_16 AC 120 ms
82,764 KB
testcase_17 AC 64 ms
72,448 KB
testcase_18 AC 79 ms
77,376 KB
testcase_19 AC 171 ms
84,148 KB
testcase_20 AC 284 ms
97,040 KB
testcase_21 AC 458 ms
92,048 KB
testcase_22 AC 226 ms
105,920 KB
testcase_23 AC 200 ms
105,744 KB
testcase_24 AC 201 ms
101,696 KB
testcase_25 AC 841 ms
99,772 KB
testcase_26 AC 326 ms
98,996 KB
testcase_27 AC 230 ms
83,364 KB
testcase_28 AC 488 ms
102,924 KB
testcase_29 AC 452 ms
95,140 KB
testcase_30 AC 687 ms
98,668 KB
testcase_31 AC 484 ms
108,072 KB
testcase_32 AC 420 ms
101,808 KB
testcase_33 AC 283 ms
95,412 KB
testcase_34 AC 150 ms
86,896 KB
testcase_35 AC 186 ms
87,920 KB
testcase_36 AC 567 ms
91,056 KB
testcase_37 AC 257 ms
100,004 KB
testcase_38 AC 87 ms
78,356 KB
testcase_39 AC 120 ms
83,056 KB
testcase_40 AC 125 ms
82,876 KB
testcase_41 AC 161 ms
88,744 KB
testcase_42 AC 122 ms
88,744 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
INF = 1 << 30

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 = [INF 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] < INF:
            left = mid
        else:
            right = mid

    Que = deque([0])
    C = [INF 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