結果

問題 No.1473 おでぶなおばけさん
ユーザー aqua_tenhouaqua_tenhou
提出日時 2021-04-09 21:51:47
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 810 bytes
コンパイル時間 803 ms
コンパイル使用メモリ 86,836 KB
実行使用メモリ 147,084 KB
最終ジャッジ日時 2023-09-07 10:57:45
合計ジャッジ時間 23,727 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
71,680 KB
testcase_01 AC 90 ms
71,368 KB
testcase_02 AC 1,300 ms
131,528 KB
testcase_03 AC 755 ms
126,028 KB
testcase_04 AC 1,046 ms
105,400 KB
testcase_05 AC 342 ms
86,272 KB
testcase_06 AC 1,432 ms
121,632 KB
testcase_07 AC 1,260 ms
127,920 KB
testcase_08 TLE -
testcase_09 AC 1,036 ms
132,864 KB
testcase_10 AC 387 ms
101,636 KB
testcase_11 AC 392 ms
101,232 KB
testcase_12 AC 311 ms
101,600 KB
testcase_13 AC 270 ms
95,884 KB
testcase_14 AC 221 ms
91,536 KB
testcase_15 AC 343 ms
104,152 KB
testcase_16 AC 290 ms
103,132 KB
testcase_17 AC 144 ms
80,232 KB
testcase_18 AC 157 ms
79,096 KB
testcase_19 AC 374 ms
101,676 KB
testcase_20 AC 634 ms
124,488 KB
testcase_21 AC 760 ms
117,512 KB
testcase_22 AC 514 ms
143,296 KB
testcase_23 AC 450 ms
139,132 KB
testcase_24 AC 439 ms
132,740 KB
testcase_25 TLE -
testcase_26 TLE -
testcase_27 AC 612 ms
93,768 KB
testcase_28 AC 1,614 ms
134,464 KB
testcase_29 AC 933 ms
117,524 KB
testcase_30 AC 1,453 ms
123,396 KB
testcase_31 AC 1,058 ms
147,084 KB
testcase_32 AC 872 ms
131,124 KB
testcase_33 AC 693 ms
122,076 KB
testcase_34 AC 549 ms
102,644 KB
testcase_35 AC 381 ms
103,428 KB
testcase_36 AC 883 ms
108,620 KB
testcase_37 AC 1,338 ms
119,736 KB
testcase_38 AC 237 ms
83,960 KB
testcase_39 AC 286 ms
101,940 KB
testcase_40 AC 293 ms
102,076 KB
testcase_41 AC 347 ms
117,856 KB
testcase_42 AC 287 ms
117,668 KB
testcase_43 AC 365 ms
126,096 KB
testcase_44 AC 385 ms
125,564 KB
testcase_45 AC 366 ms
125,596 KB
testcase_46 AC 661 ms
117,060 KB
testcase_47 AC 796 ms
120,592 KB
testcase_48 AC 585 ms
124,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

def is_ok(arg):
    w = BWS(arg)
    return w != float("Inf")


def meguru_bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

def BWS(w):
    q = deque([])
    reach = [float("Inf")]*(n+1)

    q.append(1)
    reach[1] = 0
    while q:
        x = q.popleft()
        for y,z in V[x]:
            if w <= z and reach[y] == float("Inf"):
                q.append(y)
                reach[y] = reach[x] + 1
    return reach[-1]


n,m = map(int,input().split())
z = [list(map(int,input().split())) for i in range(m)]
V = [[] for i in range(n+1)]
for s,t,d in z:
    V[s].append([t,d])
    V[t].append([s,d])

ans = meguru_bisect(10**9 + 1, 0)
print(ans, BWS(ans))
0