結果

問題 No.1473 おでぶなおばけさん
ユーザー lloyzlloyz
提出日時 2022-08-11 22:08:27
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,100 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 81,660 KB
実行使用メモリ 844,308 KB
最終ジャッジ日時 2023-10-22 03:45:04
合計ジャッジ時間 23,461 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,592 KB
testcase_01 AC 43 ms
55,592 KB
testcase_02 AC 962 ms
111,988 KB
testcase_03 AC 504 ms
106,560 KB
testcase_04 AC 523 ms
95,488 KB
testcase_05 AC 227 ms
81,532 KB
testcase_06 AC 858 ms
105,144 KB
testcase_07 AC 792 ms
112,716 KB
testcase_08 AC 1,219 ms
107,652 KB
testcase_09 AC 648 ms
109,340 KB
testcase_10 AC 212 ms
86,796 KB
testcase_11 AC 262 ms
87,208 KB
testcase_12 AC 207 ms
86,940 KB
testcase_13 AC 164 ms
80,912 KB
testcase_14 AC 131 ms
78,712 KB
testcase_15 AC 192 ms
83,576 KB
testcase_16 AC 203 ms
82,784 KB
testcase_17 AC 98 ms
77,096 KB
testcase_18 AC 107 ms
77,120 KB
testcase_19 AC 253 ms
85,104 KB
testcase_20 AC 429 ms
101,748 KB
testcase_21 AC 519 ms
93,200 KB
testcase_22 AC 308 ms
109,824 KB
testcase_23 AC 264 ms
107,764 KB
testcase_24 AC 268 ms
104,424 KB
testcase_25 AC 1,074 ms
103,212 KB
testcase_26 AC 460 ms
106,448 KB
testcase_27 AC 323 ms
82,984 KB
testcase_28 AC 627 ms
111,704 KB
testcase_29 AC 577 ms
98,652 KB
testcase_30 AC 976 ms
99,268 KB
testcase_31 AC 600 ms
113,648 KB
testcase_32 AC 544 ms
104,456 KB
testcase_33 AC 371 ms
98,972 KB
testcase_34 AC 204 ms
91,448 KB
testcase_35 AC 245 ms
86,472 KB
testcase_36 AC 856 ms
91,008 KB
testcase_37 AC 361 ms
106,832 KB
testcase_38 AC 117 ms
77,472 KB
testcase_39 AC 190 ms
84,856 KB
testcase_40 AC 188 ms
84,848 KB
testcase_41 AC 175 ms
87,388 KB
testcase_42 AC 174 ms
87,380 KB
testcase_43 MLE -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque

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**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)
0