結果

問題 No.1473 おでぶなおばけさん
ユーザー lloyzlloyz
提出日時 2022-08-11 22:11:02
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,333 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 82,524 KB
実行使用メモリ 856,456 KB
最終ジャッジ日時 2024-09-22 05:10:05
合計ジャッジ時間 20,649 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
55,648 KB
testcase_01 AC 39 ms
54,380 KB
testcase_02 AC 739 ms
108,052 KB
testcase_03 AC 385 ms
102,348 KB
testcase_04 AC 386 ms
93,608 KB
testcase_05 AC 197 ms
81,444 KB
testcase_06 AC 664 ms
100,052 KB
testcase_07 AC 649 ms
107,456 KB
testcase_08 AC 1,012 ms
106,836 KB
testcase_09 AC 571 ms
108,364 KB
testcase_10 AC 196 ms
83,792 KB
testcase_11 AC 315 ms
86,420 KB
testcase_12 AC 176 ms
84,164 KB
testcase_13 AC 157 ms
82,584 KB
testcase_14 AC 116 ms
79,048 KB
testcase_15 AC 220 ms
85,236 KB
testcase_16 AC 168 ms
82,828 KB
testcase_17 AC 86 ms
77,384 KB
testcase_18 AC 99 ms
77,284 KB
testcase_19 AC 206 ms
85,440 KB
testcase_20 AC 342 ms
101,904 KB
testcase_21 AC 479 ms
93,100 KB
testcase_22 AC 268 ms
110,172 KB
testcase_23 AC 243 ms
109,752 KB
testcase_24 AC 248 ms
104,644 KB
testcase_25 AC 816 ms
105,040 KB
testcase_26 AC 349 ms
101,452 KB
testcase_27 AC 264 ms
83,556 KB
testcase_28 AC 497 ms
109,280 KB
testcase_29 AC 461 ms
96,204 KB
testcase_30 AC 677 ms
102,960 KB
testcase_31 AC 517 ms
113,784 KB
testcase_32 AC 433 ms
105,040 KB
testcase_33 AC 297 ms
98,368 KB
testcase_34 AC 180 ms
91,840 KB
testcase_35 AC 213 ms
86,368 KB
testcase_36 AC 567 ms
93,824 KB
testcase_37 AC 289 ms
102,764 KB
testcase_38 AC 108 ms
77,560 KB
testcase_39 AC 164 ms
83,080 KB
testcase_40 AC 163 ms
83,040 KB
testcase_41 AC 196 ms
87,868 KB
testcase_42 AC 156 ms
87,740 KB
testcase_43 MLE -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque

def main():
    n, m = map(int, input().split())
    edge = defaultdict(list)
    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**9 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**9 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