結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,524 KB
testcase_01 AC 43 ms
55,524 KB
testcase_02 AC 865 ms
101,460 KB
testcase_03 AC 444 ms
98,292 KB
testcase_04 AC 466 ms
90,492 KB
testcase_05 AC 200 ms
79,868 KB
testcase_06 AC 692 ms
96,612 KB
testcase_07 AC 689 ms
101,636 KB
testcase_08 AC 1,099 ms
102,436 KB
testcase_09 AC 626 ms
103,468 KB
testcase_10 AC 210 ms
83,564 KB
testcase_11 AC 325 ms
85,908 KB
testcase_12 AC 180 ms
83,584 KB
testcase_13 AC 166 ms
82,208 KB
testcase_14 AC 119 ms
78,496 KB
testcase_15 AC 226 ms
84,544 KB
testcase_16 AC 166 ms
82,504 KB
testcase_17 AC 87 ms
76,832 KB
testcase_18 AC 100 ms
76,872 KB
testcase_19 AC 219 ms
84,332 KB
testcase_20 AC 356 ms
97,048 KB
testcase_21 AC 506 ms
91,756 KB
testcase_22 AC 283 ms
105,752 KB
testcase_23 AC 257 ms
105,280 KB
testcase_24 AC 260 ms
101,484 KB
testcase_25 AC 928 ms
101,156 KB
testcase_26 AC 401 ms
98,576 KB
testcase_27 AC 267 ms
82,640 KB
testcase_28 AC 567 ms
103,200 KB
testcase_29 AC 511 ms
94,800 KB
testcase_30 AC 748 ms
99,532 KB
testcase_31 AC 564 ms
108,088 KB
testcase_32 AC 485 ms
99,496 KB
testcase_33 AC 342 ms
95,488 KB
testcase_34 AC 189 ms
90,084 KB
testcase_35 AC 221 ms
85,624 KB
testcase_36 AC 603 ms
93,116 KB
testcase_37 AC 311 ms
98,832 KB
testcase_38 AC 108 ms
77,260 KB
testcase_39 AC 168 ms
82,528 KB
testcase_40 AC 165 ms
82,536 KB
testcase_41 AC 200 ms
87,304 KB
testcase_42 AC 161 ms
87,168 KB
testcase_43 MLE -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

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