結果

問題 No.1473 おでぶなおばけさん
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2021-11-28 19:11:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 778 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 47,684 KB
最終ジャッジ日時 2023-09-14 06:36:20
合計ジャッジ時間 50,967 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,628 KB
testcase_01 AC 18 ms
8,484 KB
testcase_02 AC 1,814 ms
44,396 KB
testcase_03 AC 898 ms
37,964 KB
testcase_04 AC 1,106 ms
27,960 KB
testcase_05 AC 364 ms
15,176 KB
testcase_06 AC 1,786 ms
39,624 KB
testcase_07 AC 1,512 ms
47,108 KB
testcase_08 TLE -
testcase_09 AC 1,214 ms
46,776 KB
testcase_10 AC 1,270 ms
29,572 KB
testcase_11 AC 1,449 ms
28,444 KB
testcase_12 AC 772 ms
29,940 KB
testcase_13 AC 484 ms
20,272 KB
testcase_14 AC 346 ms
17,172 KB
testcase_15 AC 986 ms
25,276 KB
testcase_16 AC 687 ms
28,404 KB
testcase_17 AC 49 ms
9,800 KB
testcase_18 AC 87 ms
10,492 KB
testcase_19 AC 858 ms
27,548 KB
testcase_20 AC 687 ms
34,876 KB
testcase_21 AC 1,317 ms
35,156 KB
testcase_22 AC 728 ms
35,968 KB
testcase_23 AC 577 ms
32,688 KB
testcase_24 AC 594 ms
31,792 KB
testcase_25 TLE -
testcase_26 TLE -
testcase_27 AC 641 ms
19,928 KB
testcase_28 AC 1,851 ms
45,532 KB
testcase_29 AC 1,309 ms
33,492 KB
testcase_30 AC 1,755 ms
38,564 KB
testcase_31 AC 1,296 ms
44,928 KB
testcase_32 AC 1,193 ms
40,544 KB
testcase_33 AC 955 ms
34,620 KB
testcase_34 AC 476 ms
22,196 KB
testcase_35 AC 529 ms
24,028 KB
testcase_36 AC 1,381 ms
30,344 KB
testcase_37 AC 1,164 ms
33,204 KB
testcase_38 AC 191 ms
13,216 KB
testcase_39 AC 873 ms
28,668 KB
testcase_40 AC 658 ms
28,900 KB
testcase_41 AC 573 ms
25,916 KB
testcase_42 AC 585 ms
25,728 KB
testcase_43 AC 826 ms
37,652 KB
testcase_44 AC 833 ms
37,608 KB
testcase_45 AC 835 ms
37,580 KB
testcase_46 AC 997 ms
35,660 KB
testcase_47 AC 1,054 ms
40,524 KB
testcase_48 AC 1,164 ms
38,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict,deque
import sys
sys.setrecursionlimit(10**6)

N,M = map(int,input().split())
e = defaultdict(list)
for _ in range(M):
    s,t,d = map(int,input().split())
    s -= 1
    t -= 1
    e[s].append((d,t))
    e[t].append((d,s))
    
v = deque()

def is_ok(x):
    dist = [-1]*N
    dist[0] = 0
    v.append(0)
    while v:
        ix = v.popleft()
        
        for d,jx in e[ix]:
            if dist[jx] != -1:
                continue
            if d>=x:
                dist[jx] = dist[ix] + 1
                v.append(jx)
    if dist[N-1] == -1:
        return False
    else:
        return dist[N-1]
        
x = 0
y = 10**10
while y-x>1:
    mid = (y+x)//2
    if is_ok(mid):
        x = mid
    else:
        y = mid
print(x,is_ok(x))
0