結果

問題 No.1473 おでぶなおばけさん
ユーザー lloyzlloyz
提出日時 2022-08-11 21:58:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 815 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 81,692 KB
実行使用メモリ 846,884 KB
最終ジャッジ日時 2023-10-22 03:38:08
合計ジャッジ時間 23,022 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
55,576 KB
testcase_01 AC 42 ms
55,576 KB
testcase_02 AC 814 ms
111,768 KB
testcase_03 AC 425 ms
105,804 KB
testcase_04 AC 469 ms
94,920 KB
testcase_05 AC 198 ms
81,240 KB
testcase_06 AC 756 ms
104,208 KB
testcase_07 AC 748 ms
111,364 KB
testcase_08 AC 1,123 ms
107,488 KB
testcase_09 AC 595 ms
108,244 KB
testcase_10 AC 189 ms
83,736 KB
testcase_11 AC 244 ms
87,000 KB
testcase_12 AC 195 ms
86,912 KB
testcase_13 AC 155 ms
80,852 KB
testcase_14 AC 124 ms
78,664 KB
testcase_15 AC 182 ms
83,528 KB
testcase_16 AC 190 ms
82,744 KB
testcase_17 AC 93 ms
77,044 KB
testcase_18 AC 100 ms
77,064 KB
testcase_19 AC 222 ms
84,992 KB
testcase_20 AC 367 ms
101,660 KB
testcase_21 AC 426 ms
93,076 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1,021 ms
102,376 KB
testcase_26 AC 375 ms
105,552 KB
testcase_27 AC 275 ms
82,948 KB
testcase_28 AC 561 ms
111,628 KB
testcase_29 AC 540 ms
98,056 KB
testcase_30 AC 797 ms
100,152 KB
testcase_31 AC 531 ms
113,680 KB
testcase_32 AC 495 ms
103,608 KB
testcase_33 AC 322 ms
98,400 KB
testcase_34 AC 185 ms
90,124 KB
testcase_35 AC 221 ms
86,180 KB
testcase_36 AC 815 ms
90,792 KB
testcase_37 AC 306 ms
106,176 KB
testcase_38 AC 112 ms
77,412 KB
testcase_39 AC 182 ms
82,736 KB
testcase_40 AC 182 ms
82,724 KB
testcase_41 AC 170 ms
87,336 KB
testcase_42 AC 169 ms
87,320 KB
testcase_43 MLE -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque

n, m = map(int, input().split())
edge = defaultdict(list)
for _ in range(m):
    s, t, d = map(int, input().split())
    edge[s].append((t, d))
    edge[t].append((s, d))

left, right = 1, 10**9 + 1
ans = -1
while right - left > 1:
    mid = (left + right) // 2
    flag = False
    Que = deque([1])
    C = [10**18 for _ in range(n + 1)]
    C[1] = 0
    while Que:
        cp = Que.popleft()
        if cp == n:
            flag = True
            ans = C[cp]
            break
        cnt = C[cp]
        for np, w in edge[cp]:
            if w < mid:
                continue
            if cnt + 1 > C[np]:
                continue
            C[np] = cnt + 1
            Que.append(np)
    if flag:
        left = mid
    else:
        right = mid
print(left, ans)
0