結果

問題 No.1473 おでぶなおばけさん
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-06-29 20:07:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 575 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 130,040 KB
最終ジャッジ日時 2023-09-08 05:18:47
合計ジャッジ時間 28,501 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,236 KB
testcase_01 AC 67 ms
71,140 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 904 ms
124,624 KB
testcase_08 AC 1,527 ms
123,040 KB
testcase_09 AC 636 ms
128,452 KB
testcase_10 AC 301 ms
106,548 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 210 ms
90,712 KB
testcase_14 AC 180 ms
89,320 KB
testcase_15 AC 258 ms
101,112 KB
testcase_16 AC 251 ms
97,512 KB
testcase_17 AC 115 ms
77,992 KB
testcase_18 AC 126 ms
78,132 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 290 ms
110,024 KB
testcase_42 AC 244 ms
110,112 KB
testcase_43 AC 310 ms
129,340 KB
testcase_44 AC 296 ms
129,000 KB
testcase_45 AC 297 ms
129,348 KB
testcase_46 AC 308 ms
115,208 KB
testcase_47 AC 391 ms
119,948 KB
testcase_48 AC 499 ms
114,712 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