結果

問題 No.1473 おでぶなおばけさん
ユーザー lloyzlloyz
提出日時 2022-08-11 22:21:22
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,357 bytes
コンパイル時間 1,154 ms
コンパイル使用メモリ 81,632 KB
実行使用メモリ 843,580 KB
最終ジャッジ日時 2023-10-22 03:55:28
合計ジャッジ時間 20,690 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,628 KB
testcase_01 AC 42 ms
55,628 KB
testcase_02 AC 827 ms
100,644 KB
testcase_03 AC 415 ms
98,596 KB
testcase_04 AC 430 ms
89,432 KB
testcase_05 AC 183 ms
79,524 KB
testcase_06 AC 734 ms
95,812 KB
testcase_07 AC 645 ms
101,600 KB
testcase_08 AC 1,024 ms
101,728 KB
testcase_09 AC 570 ms
103,240 KB
testcase_10 AC 159 ms
83,172 KB
testcase_11 AC 275 ms
83,092 KB
testcase_12 AC 137 ms
83,208 KB
testcase_13 AC 131 ms
81,568 KB
testcase_14 AC 97 ms
79,516 KB
testcase_15 AC 186 ms
83,584 KB
testcase_16 AC 124 ms
82,416 KB
testcase_17 AC 64 ms
70,712 KB
testcase_18 AC 80 ms
76,884 KB
testcase_19 AC 191 ms
83,848 KB
testcase_20 AC 324 ms
96,720 KB
testcase_21 AC 501 ms
91,804 KB
testcase_22 AC 242 ms
105,768 KB
testcase_23 AC 210 ms
105,216 KB
testcase_24 AC 215 ms
101,156 KB
testcase_25 AC 886 ms
99,268 KB
testcase_26 AC 372 ms
98,048 KB
testcase_27 AC 261 ms
83,056 KB
testcase_28 AC 535 ms
102,704 KB
testcase_29 AC 502 ms
94,800 KB
testcase_30 AC 727 ms
98,148 KB
testcase_31 AC 529 ms
107,760 KB
testcase_32 AC 446 ms
101,016 KB
testcase_33 AC 302 ms
95,120 KB
testcase_34 AC 156 ms
86,672 KB
testcase_35 AC 191 ms
87,568 KB
testcase_36 AC 591 ms
89,960 KB
testcase_37 AC 291 ms
98,452 KB
testcase_38 AC 89 ms
77,836 KB
testcase_39 AC 126 ms
82,372 KB
testcase_40 AC 125 ms
82,376 KB
testcase_41 AC 165 ms
88,312 KB
testcase_42 AC 127 ms
88,312 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] * 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] * 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