Page 1 of 2

11335 - Discrete Pursuit

Posted: Sun Nov 04, 2007 3:34 am
by shakil
Sorry.......

Posted: Sun Nov 04, 2007 3:52 am
by sclo
Read the problem carefully. At time t=0, the only possible position of cop is (0,0) and velocity is (0,0). At time t=1, the possible velocity of the cop is (u,v) where -1<=u,v<=1 and the possible position is (x,y)=(0,0)+(u,v) where -1<=x,y<=1. For this problem it is sufficient to only know the maximum bounds on x,y,u,v.
Let x[t]=maximum bound of x at time t, then
x[t]=x[t-1]+t

need sample i/o

Posted: Sun Nov 04, 2007 5:58 pm
by deena sultana
Can anyone give some sample i/o for 11335, plzzz? i am getting WA
:cry:

Re: need sample i/o

Posted: Mon Nov 05, 2007 12:48 am
by sclo
deena sultana wrote:Can anyone give some sample i/o for 11335, plzzz? i am getting WA
:cry:
It might give the problem away if I give any more input/output. You could easily write a bruteforce bfs program to check your results.

Re: need sample i/o

Posted: Mon Nov 05, 2007 12:27 pm
by sohel
deena sultana wrote:Can anyone give some sample i/o for 11335, plzzz? i am getting WA
:cry:
and also it would be more helpful if you describe your algorithm first!!

Hint: consider x and y component separately.

Posted: Mon Nov 05, 2007 12:58 pm
by deena sultana
well, my algorithm is like this...
1. for t=0, the object's position is (0,0) and u=0, v=0 and the thief's position is (a,0), as the problem states.
2. then for t=1 the object will move at the position from where the distance of the thief's current position (at t=1) is minimum;
3. repeat this process until the distance is 0.

wont it work?

Posted: Mon Nov 05, 2007 1:04 pm
by sohel
ds wrote:the object will move at the position from where the distance of the thief's current position (at t=1) is minimum
By distance, do you mean the Manhattan distance or the Euclidean distance?

And don't you take the current speed in consideration?
What if you have two places with the same minimum distance, which point do you consider then?

Posted: Mon Nov 05, 2007 1:19 pm
by deena sultana
ops sorry for my incomplete description :P
i've calculated the Manhattan distance, and also considered the current speed. but, in case of tie i 've chosen the 1st one :-S (may be this is the fault, no?)

Posted: Mon Nov 05, 2007 9:38 pm
by sclo
deena sultana wrote:ops sorry for my incomplete description :P
i've calculated the Manhattan distance, and also considered the current speed. but, in case of tie i 've chosen the 1st one :-S (may be this is the fault, no?)
Your algorithm is wrong. In any optimal solution, the direction of the cop doesn't change much. But in your algorithm, the cop can change direction.

Posted: Tue Nov 06, 2007 12:01 pm
by deena sultana
yes, i understand :(
it was a stupid algorithm :roll:
sorry :(

Posted: Tue Nov 06, 2007 5:12 pm
by deena sultana
Hint: consider x and y component separately.
Wow! this hint is simply great! who r trying to solve 11335, plz think about it and have a pretty solution :-)
thanks to sohel. thanks to sclo too.

Posted: Wed Jan 16, 2008 9:12 pm
by andmej
Is this problem solvable using Dynamic Programming? :oops:

Posted: Thu Jan 17, 2008 4:15 am
by rio
I don't think DP is suitable for this problem.

-----
Rio

Re: 11335 - Discrete Pursuit

Posted: Fri Sep 05, 2008 8:12 pm
by slxst
I honestly don't know where to begin to attack this problem but it seems that this problem is really easy.

Could anyone give me a little hints about where to start?

By the way: I don't know what the other posters are meaning about x component and y component.

Thanks a lot.

Re: 11335 - Discrete Pursuit

Posted: Sun Sep 07, 2008 2:04 am
by andmej
Imagine you had to solve a simpler problem: The thief and the cop can only move along one axis. In that case, how would you calculate the minimum time needed for the cop to catch the thief in only that direction?

For example, imagine that the cop can't move along the y-axis (he can only move along the x-axis) and same for the thief. If thief is at position (0, a) and cop is at position (0, 0), how would the cop move to catch him?

Now, imagine the opposite thing along the y-axis (that is, neither the cop nor the thief can move along the x-axis), and compute the time.

The final answer will be the maximum of these two values, because the cop can advance in both directions simultaneously and he can "work" on the two solutions at the same time.

Hope this helps. If I'm not clear enough please tell me so I can explain better.