結果

問題 No.1473 おでぶなおばけさん
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-04-09 21:49:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,870 ms / 2,000 ms
コード長 633 bytes
コンパイル時間 379 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 117,012 KB
最終ジャッジ日時 2023-09-07 10:52:16
合計ジャッジ時間 29,142 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,432 KB
testcase_01 AC 98 ms
71,348 KB
testcase_02 AC 882 ms
108,412 KB
testcase_03 AC 567 ms
104,500 KB
testcase_04 AC 741 ms
94,356 KB
testcase_05 AC 275 ms
81,520 KB
testcase_06 AC 963 ms
100,948 KB
testcase_07 AC 812 ms
105,260 KB
testcase_08 AC 1,412 ms
117,012 KB
testcase_09 AC 755 ms
106,272 KB
testcase_10 AC 256 ms
86,008 KB
testcase_11 AC 272 ms
85,940 KB
testcase_12 AC 258 ms
86,124 KB
testcase_13 AC 211 ms
82,984 KB
testcase_14 AC 186 ms
80,676 KB
testcase_15 AC 249 ms
85,896 KB
testcase_16 AC 232 ms
84,960 KB
testcase_17 AC 144 ms
77,636 KB
testcase_18 AC 146 ms
78,772 KB
testcase_19 AC 322 ms
86,016 KB
testcase_20 AC 490 ms
99,860 KB
testcase_21 AC 531 ms
94,244 KB
testcase_22 AC 418 ms
106,800 KB
testcase_23 AC 387 ms
107,668 KB
testcase_24 AC 367 ms
103,472 KB
testcase_25 AC 1,786 ms
110,316 KB
testcase_26 AC 1,870 ms
111,496 KB
testcase_27 AC 329 ms
83,440 KB
testcase_28 AC 1,087 ms
114,100 KB
testcase_29 AC 667 ms
97,160 KB
testcase_30 AC 1,008 ms
100,120 KB
testcase_31 AC 752 ms
110,428 KB
testcase_32 AC 629 ms
101,392 KB
testcase_33 AC 534 ms
97,008 KB
testcase_34 AC 374 ms
89,488 KB
testcase_35 AC 317 ms
87,788 KB
testcase_36 AC 631 ms
91,340 KB
testcase_37 AC 914 ms
101,124 KB
testcase_38 AC 212 ms
80,172 KB
testcase_39 AC 223 ms
84,820 KB
testcase_40 AC 223 ms
84,880 KB
testcase_41 AC 267 ms
87,956 KB
testcase_42 AC 219 ms
88,020 KB
testcase_43 AC 282 ms
98,132 KB
testcase_44 AC 280 ms
98,092 KB
testcase_45 AC 287 ms
97,940 KB
testcase_46 AC 453 ms
98,048 KB
testcase_47 AC 537 ms
97,036 KB
testcase_48 AC 526 ms
97,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n,m = map(int,input().split())
e = [[] for i in range(n)]
for i in range(m):
    s,t,d = map(int,input().split())
    s -= 1
    t -= 1
    e[s].append((t,d))
    e[t].append((s,d))
inf = 10**20

def search(M):
    dis = [inf]*n
    dis[0] = 0
    q = deque([0])
    while q:
        now = q.popleft()
        for nex,d in e[now]:
            if d >= M and dis[nex] > dis[now]+1:
                dis[nex] = dis[now]+1
                q.append(nex)
    return dis[-1]


l = 0
r = 10**9+5
while r > l + 1:
    m = (r+l)//2
    if search(m) == inf:
        r = m
    else:
        l = m
print(l,search(l))
0