Help to solve hackerearth problem rescuer

In this question https://www.hackerearth.com/problem/algorithm/rescuer-1/description/
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