結果

問題 No.1473 おでぶなおばけさん
ユーザー ygd.ygd.
提出日時 2021-04-10 16:23:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,372 ms / 2,000 ms
コード長 738 bytes
コンパイル時間 500 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 127,636 KB
最終ジャッジ日時 2023-09-08 12:22:33
合計ジャッジ時間 24,967 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,624 KB
testcase_01 AC 91 ms
71,672 KB
testcase_02 AC 881 ms
113,628 KB
testcase_03 AC 442 ms
120,644 KB
testcase_04 AC 617 ms
96,048 KB
testcase_05 AC 256 ms
81,716 KB
testcase_06 AC 873 ms
105,308 KB
testcase_07 AC 723 ms
112,220 KB
testcase_08 AC 1,123 ms
110,728 KB
testcase_09 AC 622 ms
117,764 KB
testcase_10 AC 241 ms
86,384 KB
testcase_11 AC 248 ms
86,588 KB
testcase_12 AC 267 ms
87,772 KB
testcase_13 AC 206 ms
83,300 KB
testcase_14 AC 173 ms
80,744 KB
testcase_15 AC 233 ms
86,048 KB
testcase_16 AC 218 ms
85,124 KB
testcase_17 AC 134 ms
78,072 KB
testcase_18 AC 142 ms
78,872 KB
testcase_19 AC 300 ms
86,268 KB
testcase_20 AC 413 ms
110,984 KB
testcase_21 AC 455 ms
99,160 KB
testcase_22 AC 327 ms
124,996 KB
testcase_23 AC 294 ms
124,080 KB
testcase_24 AC 287 ms
117,172 KB
testcase_25 AC 1,348 ms
106,552 KB
testcase_26 AC 1,372 ms
106,412 KB
testcase_27 AC 278 ms
83,252 KB
testcase_28 AC 1,039 ms
112,200 KB
testcase_29 AC 584 ms
102,384 KB
testcase_30 AC 780 ms
102,068 KB
testcase_31 AC 648 ms
127,636 KB
testcase_32 AC 544 ms
111,352 KB
testcase_33 AC 474 ms
105,472 KB
testcase_34 AC 317 ms
94,928 KB
testcase_35 AC 275 ms
91,416 KB
testcase_36 AC 476 ms
94,008 KB
testcase_37 AC 717 ms
106,504 KB
testcase_38 AC 190 ms
80,524 KB
testcase_39 AC 223 ms
85,172 KB
testcase_40 AC 226 ms
85,208 KB
testcase_41 AC 265 ms
88,352 KB
testcase_42 AC 224 ms
88,476 KB
testcase_43 AC 270 ms
105,596 KB
testcase_44 AC 267 ms
105,600 KB
testcase_45 AC 270 ms
105,244 KB
testcase_46 AC 391 ms
109,340 KB
testcase_47 AC 472 ms
104,944 KB
testcase_48 AC 473 ms
105,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n,m = map(int,input().split()); INF = float("inf")
G = [[] for _ in range(n)]
for i in range(m):
    s,t,d = map(int,input().split())
    s-=1;t-=1
    G[s].append((t,d))
    G[t].append((s,d))

def BFS(w):
    D = [INF]*n
    D[0] = 0
    Q = deque([])
    Q.append(0)
    while Q:
        v = Q.popleft()
        for u,d in G[v]:
            if d < w: continue
            if D[u] <= D[v] + 1: continue
            D[u] = D[v] + 1
            Q.append(u)
    return D
            
    
ok = 1
ng = pow(10,9) + 1
while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    dis = BFS(mid)
    #print(dis,mid)
    if dis[n-1] < INF:
        ok = mid
    else:
        ng = mid
dis = BFS(ok)
ans = [ok,dis[n-1]]
print(*ans)
0