結果

問題 No.1473 おでぶなおばけさん
ユーザー lloyzlloyz
提出日時 2022-08-11 22:18:05
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,380 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 81,820 KB
実行使用メモリ 848,708 KB
最終ジャッジ日時 2023-10-22 03:53:13
合計ジャッジ時間 16,596 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,712 KB
testcase_01 AC 41 ms
55,484 KB
testcase_02 AC 624 ms
100,456 KB
testcase_03 AC 302 ms
97,872 KB
testcase_04 AC 297 ms
89,376 KB
testcase_05 AC 157 ms
79,428 KB
testcase_06 AC 471 ms
95,528 KB
testcase_07 AC 446 ms
101,720 KB
testcase_08 AC 717 ms
101,852 KB
testcase_09 AC 463 ms
103,188 KB
testcase_10 AC 141 ms
83,044 KB
testcase_11 AC 251 ms
82,980 KB
testcase_12 AC 129 ms
83,076 KB
testcase_13 AC 119 ms
81,440 KB
testcase_14 AC 86 ms
79,372 KB
testcase_15 AC 168 ms
83,468 KB
testcase_16 AC 111 ms
82,288 KB
testcase_17 AC 61 ms
72,640 KB
testcase_18 AC 74 ms
76,756 KB
testcase_19 AC 166 ms
83,736 KB
testcase_20 AC 264 ms
96,596 KB
testcase_21 AC 363 ms
91,700 KB
testcase_22 AC 203 ms
105,648 KB
testcase_23 AC 181 ms
105,092 KB
testcase_24 AC 184 ms
101,032 KB
testcase_25 AC 616 ms
99,324 KB
testcase_26 AC 268 ms
98,316 KB
testcase_27 AC 216 ms
83,128 KB
testcase_28 AC 410 ms
102,604 KB
testcase_29 AC 380 ms
94,712 KB
testcase_30 AC 535 ms
98,100 KB
testcase_31 AC 434 ms
107,636 KB
testcase_32 AC 339 ms
100,892 KB
testcase_33 AC 238 ms
94,992 KB
testcase_34 AC 130 ms
86,548 KB
testcase_35 AC 160 ms
87,468 KB
testcase_36 AC 444 ms
90,444 KB
testcase_37 AC 208 ms
99,432 KB
testcase_38 AC 77 ms
77,724 KB
testcase_39 AC 106 ms
82,252 KB
testcase_40 AC 107 ms
82,248 KB
testcase_41 AC 142 ms
88,200 KB
testcase_42 AC 108 ms
88,200 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