結果

問題 No.1473 おでぶなおばけさん
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-04-12 00:27:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,387 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 86,756 KB
実行使用メモリ 110,416 KB
最終ジャッジ日時 2023-09-10 06:27:13
合計ジャッジ時間 27,701 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,548 KB
testcase_01 AC 91 ms
71,460 KB
testcase_02 AC 695 ms
102,184 KB
testcase_03 AC 429 ms
104,048 KB
testcase_04 AC 538 ms
91,636 KB
testcase_05 AC 245 ms
81,140 KB
testcase_06 AC 847 ms
98,392 KB
testcase_07 AC 694 ms
103,268 KB
testcase_08 AC 1,063 ms
104,812 KB
testcase_09 AC 613 ms
104,644 KB
testcase_10 AC 246 ms
86,148 KB
testcase_11 AC 245 ms
86,080 KB
testcase_12 AC 233 ms
86,396 KB
testcase_13 AC 194 ms
82,884 KB
testcase_14 AC 167 ms
80,904 KB
testcase_15 AC 226 ms
85,964 KB
testcase_16 AC 226 ms
84,936 KB
testcase_17 AC 135 ms
77,816 KB
testcase_18 AC 139 ms
78,544 KB
testcase_19 AC 296 ms
85,784 KB
testcase_20 AC 393 ms
99,712 KB
testcase_21 AC 448 ms
94,032 KB
testcase_22 AC 354 ms
106,776 KB
testcase_23 AC 322 ms
107,616 KB
testcase_24 AC 314 ms
103,528 KB
testcase_25 AC 1,380 ms
100,956 KB
testcase_26 AC 1,387 ms
101,360 KB
testcase_27 AC 260 ms
82,880 KB
testcase_28 AC 858 ms
106,948 KB
testcase_29 AC 582 ms
95,564 KB
testcase_30 AC 801 ms
96,272 KB
testcase_31 AC 623 ms
110,416 KB
testcase_32 AC 555 ms
101,432 KB
testcase_33 AC 440 ms
97,120 KB
testcase_34 AC 320 ms
89,648 KB
testcase_35 AC 265 ms
87,540 KB
testcase_36 AC 456 ms
89,800 KB
testcase_37 AC 704 ms
96,272 KB
testcase_38 AC 183 ms
79,980 KB
testcase_39 AC 221 ms
84,976 KB
testcase_40 AC 222 ms
84,644 KB
testcase_41 AC 264 ms
87,972 KB
testcase_42 AC 212 ms
88,184 KB
testcase_43 AC 257 ms
97,172 KB
testcase_44 AC 260 ms
97,112 KB
testcase_45 AC 257 ms
97,280 KB
testcase_46 AC 377 ms
97,884 KB
testcase_47 AC 447 ms
96,888 KB
testcase_48 AC 464 ms
97,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n, m = map(int, input().split())
G = [[] for i in range(n)]
for _ in range(m):
    s, t, d = map(int, input().split())
    s -= 1; t -= 1
    G[s].append((t, d))
    G[t].append((s, d))
INF = 10 ** 18
def is_ok(x):
    dist = [INF] * n
    dist[0] = 0
    Q = deque([0])
    while Q:
        p = Q.popleft()
        dc = dist[p] + 1
        for u, d in G[p]:
            if d >= x and dist[u] > dc:
                dist[u] = dc
                Q.append(u)
    return dist[-1]
l, r = 0, 10 ** 9 + 1
while r - l > 1:
    mid = (l + r) // 2
    tmp = is_ok(mid)
    if tmp == INF:
        r = mid
    else:
        l = mid
print(l, is_ok(l))
0