結果

問題 No.1473 おでぶなおばけさん
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-06-29 20:07:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 575 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 128,896 KB
最終ジャッジ日時 2024-06-25 22:33:46
合計ジャッジ時間 25,118 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,224 KB
testcase_01 AC 36 ms
51,712 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 701 ms
123,944 KB
testcase_08 AC 1,306 ms
122,404 KB
testcase_09 AC 619 ms
126,360 KB
testcase_10 AC 259 ms
105,676 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 177 ms
90,924 KB
testcase_14 AC 161 ms
89,728 KB
testcase_15 AC 235 ms
100,736 KB
testcase_16 AC 215 ms
97,792 KB
testcase_17 AC 88 ms
77,184 KB
testcase_18 AC 97 ms
77,184 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 280 ms
112,256 KB
testcase_42 AC 226 ms
112,256 KB
testcase_43 AC 282 ms
126,576 KB
testcase_44 AC 280 ms
126,336 KB
testcase_45 AC 296 ms
126,312 KB
testcase_46 AC 272 ms
113,920 KB
testcase_47 AC 339 ms
119,296 KB
testcase_48 AC 437 ms
113,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
std=[list(map(int,input().split())) for _ in range(m)]
g=[[] for _ in range(n)]
for s,t,d in std:
  s,t=s-1,t-1
  g[s].append([t,d])
  g[t].append([s,d])
def func(x):
  todo=[0]
  seen=[-1]*n
  seen[0]=0
  while todo:
    v=todo.pop()
    for nv,d in g[v]:
      if x<=d and seen[nv]==-1:
        todo.append(nv)
        seen[nv]=seen[v]+1
  return seen[n-1]
l,r=0,10**9+1
ans=10**9+1
while r-l>1:
  x=(l+r)//2
  y=func(x)
  if y>=0:
    ans=min(ans,y)
    l,r=x,r
  else:
    l,r=l,x
y=func(l)
if y>=0:
  print(l,y)
else:
  print(l+1,func(l+1))
0