結果

問題 No.1473 おでぶなおばけさん
ユーザー lloyzlloyz
提出日時 2022-08-11 22:15:39
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,369 bytes
コンパイル時間 752 ms
コンパイル使用メモリ 81,568 KB
実行使用メモリ 897,508 KB
最終ジャッジ日時 2023-10-22 03:50:54
合計ジャッジ時間 17,131 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
55,680 KB
testcase_01 MLE -
testcase_02 AC 600 ms
100,392 KB
testcase_03 AC 287 ms
97,864 KB
testcase_04 AC 277 ms
89,328 KB
testcase_05 AC 156 ms
79,420 KB
testcase_06 AC 460 ms
95,468 KB
testcase_07 AC 420 ms
101,664 KB
testcase_08 AC 696 ms
101,672 KB
testcase_09 AC 445 ms
103,124 KB
testcase_10 AC 140 ms
83,044 KB
testcase_11 AC 239 ms
82,968 KB
testcase_12 AC 121 ms
83,080 KB
testcase_13 AC 114 ms
81,428 KB
testcase_14 AC 85 ms
79,376 KB
testcase_15 AC 169 ms
83,456 KB
testcase_16 AC 111 ms
82,292 KB
testcase_17 AC 58 ms
72,624 KB
testcase_18 AC 76 ms
76,748 KB
testcase_19 AC 160 ms
83,732 KB
testcase_20 AC 254 ms
96,580 KB
testcase_21 AC 375 ms
91,684 KB
testcase_22 AC 208 ms
105,716 KB
testcase_23 AC 182 ms
105,072 KB
testcase_24 AC 182 ms
101,016 KB
testcase_25 AC 573 ms
99,224 KB
testcase_26 AC 264 ms
98,304 KB
testcase_27 AC 208 ms
82,964 KB
testcase_28 AC 357 ms
102,576 KB
testcase_29 AC 335 ms
94,636 KB
testcase_30 AC 486 ms
98,032 KB
testcase_31 AC 381 ms
107,620 KB
testcase_32 AC 321 ms
100,872 KB
testcase_33 AC 220 ms
94,988 KB
testcase_34 AC 127 ms
86,536 KB
testcase_35 AC 159 ms
87,484 KB
testcase_36 AC 427 ms
89,968 KB
testcase_37 AC 207 ms
99,284 KB
testcase_38 AC 78 ms
77,724 KB
testcase_39 AC 107 ms
82,252 KB
testcase_40 AC 113 ms
82,252 KB
testcase_41 AC 152 ms
88,184 KB
testcase_42 AC 119 ms
88,180 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 + 1)]
    for _ in range(m):
        s, t, d = map(int, input().split())
        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([1])
        C = [10**18 for _ in range(n + 1)]
        C[1] = 0
        while Que:
            cp = Que.popleft()
            if cp == n:
                flag = True
                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 flag:
            left = mid
        else:
            right = mid

    Que = deque([1])
    C = [10**18 for _ in range(n + 1)]
    C[1] = 0
    while Que:
        cp = Que.popleft()
        if cp == n:
            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