結果

問題 No.1473 おでぶなおばけさん
ユーザー lloyzlloyz
提出日時 2022-08-11 22:05:20
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 816 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 81,800 KB
実行使用メモリ 906,224 KB
最終ジャッジ日時 2023-10-22 03:43:00
合計ジャッジ時間 22,066 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 40 ms
55,588 KB
testcase_02 AC 718 ms
111,784 KB
testcase_03 AC 391 ms
105,812 KB
testcase_04 AC 409 ms
94,912 KB
testcase_05 AC 204 ms
81,240 KB
testcase_06 AC 735 ms
104,212 KB
testcase_07 AC 681 ms
111,368 KB
testcase_08 AC 1,079 ms
107,448 KB
testcase_09 AC 568 ms
108,252 KB
testcase_10 AC 176 ms
83,744 KB
testcase_11 AC 244 ms
87,004 KB
testcase_12 AC 189 ms
86,924 KB
testcase_13 AC 160 ms
80,860 KB
testcase_14 AC 114 ms
78,672 KB
testcase_15 AC 185 ms
83,540 KB
testcase_16 AC 188 ms
82,748 KB
testcase_17 AC 100 ms
77,040 KB
testcase_18 AC 105 ms
77,072 KB
testcase_19 AC 236 ms
85,036 KB
testcase_20 AC 333 ms
101,672 KB
testcase_21 AC 411 ms
93,084 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 858 ms
102,276 KB
testcase_26 AC 358 ms
105,768 KB
testcase_27 AC 268 ms
82,808 KB
testcase_28 AC 565 ms
111,636 KB
testcase_29 AC 421 ms
98,064 KB
testcase_30 AC 701 ms
100,108 KB
testcase_31 AC 486 ms
113,692 KB
testcase_32 AC 463 ms
103,616 KB
testcase_33 AC 298 ms
98,404 KB
testcase_34 AC 168 ms
90,132 KB
testcase_35 AC 211 ms
86,184 KB
testcase_36 AC 683 ms
90,800 KB
testcase_37 AC 301 ms
106,180 KB
testcase_38 AC 105 ms
77,420 KB
testcase_39 AC 175 ms
82,736 KB
testcase_40 AC 186 ms
82,732 KB
testcase_41 AC 150 ms
87,344 KB
testcase_42 AC 152 ms
87,328 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 + 10
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