結果

問題 No.1473 おでぶなおばけさん
ユーザー wolgnikwolgnik
提出日時 2021-04-09 21:41:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,189 ms / 2,000 ms
コード長 597 bytes
コンパイル時間 534 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 110,568 KB
最終ジャッジ日時 2023-09-07 10:32:10
合計ジャッジ時間 21,266 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,284 KB
testcase_01 AC 90 ms
71,660 KB
testcase_02 AC 637 ms
102,860 KB
testcase_03 AC 418 ms
104,520 KB
testcase_04 AC 551 ms
91,512 KB
testcase_05 AC 215 ms
81,292 KB
testcase_06 AC 771 ms
98,380 KB
testcase_07 AC 620 ms
103,576 KB
testcase_08 AC 999 ms
102,748 KB
testcase_09 AC 536 ms
103,588 KB
testcase_10 AC 212 ms
86,068 KB
testcase_11 AC 227 ms
85,932 KB
testcase_12 AC 209 ms
85,916 KB
testcase_13 AC 157 ms
82,344 KB
testcase_14 AC 148 ms
79,672 KB
testcase_15 AC 208 ms
85,212 KB
testcase_16 AC 174 ms
85,112 KB
testcase_17 AC 115 ms
77,776 KB
testcase_18 AC 121 ms
77,760 KB
testcase_19 AC 240 ms
85,228 KB
testcase_20 AC 368 ms
99,856 KB
testcase_21 AC 388 ms
92,428 KB
testcase_22 AC 305 ms
107,380 KB
testcase_23 AC 284 ms
107,828 KB
testcase_24 AC 271 ms
103,452 KB
testcase_25 AC 1,189 ms
100,696 KB
testcase_26 AC 1,172 ms
98,952 KB
testcase_27 AC 230 ms
82,548 KB
testcase_28 AC 799 ms
103,964 KB
testcase_29 AC 454 ms
95,732 KB
testcase_30 AC 675 ms
95,600 KB
testcase_31 AC 546 ms
110,568 KB
testcase_32 AC 493 ms
102,964 KB
testcase_33 AC 386 ms
97,324 KB
testcase_34 AC 267 ms
89,024 KB
testcase_35 AC 231 ms
87,720 KB
testcase_36 AC 383 ms
90,072 KB
testcase_37 AC 652 ms
97,608 KB
testcase_38 AC 159 ms
79,892 KB
testcase_39 AC 179 ms
85,124 KB
testcase_40 AC 181 ms
85,032 KB
testcase_41 AC 189 ms
87,880 KB
testcase_42 AC 175 ms
88,168 KB
testcase_43 AC 221 ms
96,760 KB
testcase_44 AC 215 ms
96,984 KB
testcase_45 AC 218 ms
97,024 KB
testcase_46 AC 300 ms
98,456 KB
testcase_47 AC 361 ms
97,692 KB
testcase_48 AC 347 ms
97,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque as dq
input = sys.stdin.readline
N, M = map(int, input().split())
e = [[] for _ in range(N + 1)]
for _ in range(M):
  u, v, c = map(int, input().split())
  e[u].append((v, c))
  e[v].append((u, c))

def check(w):
  Q = dq([1])
  dp = [-1] * (N + 1)
  dp[1] = 0
  while len(Q):
    x = Q.popleft()
    for y, d in e[x]:
      if dp[y] != -1: continue
      if d >= w:
        dp[y] = dp[x] + 1
        Q.append(y)
  return dp[N]

ok = 0
ng = 10 ** 9 + 1
while ng - ok > 1:
  m = (ok + ng) // 2
  if check(m) != -1: ok = m
  else: ng = m
print(ok, check(ok))
0