Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя codeanna

Автор codeanna, история, 5 лет назад, По-английски

In this question https://www.hackerearth.com/problem/algorithm/rescuer-1/description/ 2 for finding the point on x axis say P,where the straight line (joining the two point) cuts on x axis, form a linear equation and put y=0,this will give P but in editorial they use terniary search for finding P and answer is not same. Is my approach correct?? Pls help? Thanks

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

You seem to be assuming that it's best for Bob to run in a straight line. But this might not be the case. If Bob is very fast on land and very slow in the water, he wants to go through as little water as possible, even if it means a longer distance.