# Minimum time required to reach a point [closed]

A police inspecter P is at point $(\acute{x},\acute{y})$ and a thief X is at point $(x, y)$. X has a constant velocity $V_x\hat{i} + V_y\hat{j}$, where $\hat{i}$ and $\hat{j}$ are unit vectors in $X$ and $Y$ direction respectively. Maximum speed of P is S. What is the minimum time in which P will catch X? (assuming thatthe acceleration and deceleration of P are instantaneous)

-

## closed as too localized by Emilio Pisanty, Manishearth♦, Qmechanic♦Dec 10 '12 at 10:17

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Pure homework questions are discouraged by the FAQ. Provide details of the concepts you are struggling with and a reasonable try at the problem, and we can then help you. – Emilio Pisanty Nov 22 '12 at 17:06
@EmilioPisanty, it is not a homework question. Just a part of coding question on spoj. In this case I knew the concepts, but was unable to find a solution as was taking a very lengthy approach – Anubhav Agarwal Nov 22 '12 at 18:20

Initial coordinates of the thief: $(x_0, y_0)$, initial coordinates of the officer: $(0,0)$. Assume the thief to have velocity $(t_x,t_y)$. The officer has speed $(p_x,p_y)$ with maximum speed $p_m^2 \geq p_x^2 + p_y^2$.
Since the thief has a constant velocity (i.e. does not run away from the officer), it appears logical that the best way for the officer to catch the thief is to run in a straight towards a particular point along the thief’s trajectory. Hence we have $p_x = \textrm{ const } = p_y$. This has the nice side effect that we don’t have to differentiate anything to find the minimum time $t$ at which the two meet, since they will only meet once. One can then set up equations as following:
$$p_x t = x_0 + t_x t \qquad (1)$$ $$p_y t = y_0 + t_y t \qquad (2)$$ $$p_m^2 = p_x^2 + p_y^2 \qquad (3)$$
Solving $(3)$ for $p_x$, substituting in $(1)$, solving for $p_y$ and then substituting in $(2)$ yields a single equation with only one unknown, $t$. Solving and substituting back into $(1)$ and $(2)$ gives $p_{x,y}$.