結果

問題 No.1473 おでぶなおばけさん
ユーザー gorugo30gorugo30
提出日時 2021-05-08 16:56:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 767 ms / 2,000 ms
コード長 714 bytes
コンパイル時間 2,530 ms
コンパイル使用メモリ 81,652 KB
実行使用メモリ 108,180 KB
最終ジャッジ日時 2023-10-16 22:08:25
合計ジャッジ時間 21,554 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
55,596 KB
testcase_01 AC 37 ms
55,596 KB
testcase_02 AC 465 ms
101,184 KB
testcase_03 AC 319 ms
101,988 KB
testcase_04 AC 356 ms
90,444 KB
testcase_05 AC 182 ms
79,896 KB
testcase_06 AC 528 ms
97,040 KB
testcase_07 AC 463 ms
102,848 KB
testcase_08 AC 728 ms
102,980 KB
testcase_09 AC 413 ms
103,720 KB
testcase_10 AC 173 ms
83,568 KB
testcase_11 AC 186 ms
83,476 KB
testcase_12 AC 168 ms
83,616 KB
testcase_13 AC 138 ms
80,632 KB
testcase_14 AC 114 ms
78,428 KB
testcase_15 AC 169 ms
83,320 KB
testcase_16 AC 170 ms
82,488 KB
testcase_17 AC 83 ms
77,016 KB
testcase_18 AC 88 ms
76,772 KB
testcase_19 AC 212 ms
84,260 KB
testcase_20 AC 280 ms
97,400 KB
testcase_21 AC 305 ms
91,704 KB
testcase_22 AC 255 ms
106,948 KB
testcase_23 AC 232 ms
104,844 KB
testcase_24 AC 222 ms
101,044 KB
testcase_25 AC 732 ms
98,400 KB
testcase_26 AC 767 ms
98,660 KB
testcase_27 AC 206 ms
81,152 KB
testcase_28 AC 556 ms
103,540 KB
testcase_29 AC 345 ms
92,316 KB
testcase_30 AC 481 ms
94,984 KB
testcase_31 AC 425 ms
108,180 KB
testcase_32 AC 371 ms
99,056 KB
testcase_33 AC 305 ms
94,712 KB
testcase_34 AC 213 ms
87,288 KB
testcase_35 AC 188 ms
85,652 KB
testcase_36 AC 306 ms
88,600 KB
testcase_37 AC 489 ms
96,400 KB
testcase_38 AC 130 ms
78,560 KB
testcase_39 AC 161 ms
82,464 KB
testcase_40 AC 161 ms
82,468 KB
testcase_41 AC 198 ms
87,048 KB
testcase_42 AC 155 ms
87,036 KB
testcase_43 AC 198 ms
95,640 KB
testcase_44 AC 198 ms
96,148 KB
testcase_45 AC 198 ms
95,636 KB
testcase_46 AC 266 ms
95,224 KB
testcase_47 AC 306 ms
98,476 KB
testcase_48 AC 290 ms
98,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
adj = [[] for i in range(N)]
for i in range(M):
    s, t, d = map(int, input().split())
    s -= 1
    t -= 1
    adj[s].append((t, d))
    adj[t].append((s, d))

from collections import deque
def mindist(w):
    qu = deque([0])
    dist = [-1] * N
    dist[0] = 0
    while len(qu):
        v = qu.popleft()
        for nv, d in adj[v]:
            if d < w:
                continue
            if dist[nv] == -1:
                qu.append(nv)
                dist[nv] = dist[v] + 1
    return dist[N - 1]

st = 0
en = 10 ** 9 + 1
while en - st > 1:
    mid = (en + st) // 2
    d = mindist(mid)
    if d == -1:
        en = mid
    else:
        st = mid

print(st, mindist(st))
0