Didn’t understand why the distance between tourist 1 and tourist 2 will remain the same at any point of time ?
Pls help.
Tourist SPOJ : multi DP
Hi @aman2382000,
the distance between tourist 1 and tourist 2 will remain the same at any point of time. This is very intuitive.
consider a grid like
a b c d
e f g h
i j k l
m n o p
q r s t
suppose u want to go from a to t.
so for that u will hv to go 4 steps left and 5 steps down.So, it will take total nine steps for u to reach t.
so whichever path u take, it will take 9 steps to reach t.So, inorder to reach any point. tourist will take x steps no matter which path he follows.
Moreover, at any point, tourist 1 and 2 are taking 1 step each. So, at any point, they both would have taken equal number of steps to reach wherever they are.
SO, if tourist 1 has travelled total x1+y1, tourist 2 would also have taken x1+y1 steps.
Hope dis helps.
If u still feel something is nt clear, feel free to ask.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.