11335 - Discrete Pursuit
Moderator: Board moderators
-
- Learning poster
- Posts: 74
- Joined: Sat Jul 15, 2006 6:28 am
- Location: CUET , bangladesh
- Contact:
11335 - Discrete Pursuit
Sorry.......
Last edited by shakil on Mon Nov 05, 2007 7:36 pm, edited 1 time in total.
SHAKIL
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
Let x[t]=maximum bound of x at time t, then
x[t]=x[t-1]+t
-
- New poster
- Posts: 36
- Joined: Mon Jun 19, 2006 5:43 pm
- Location: Bangladesh
- Contact:
need sample i/o
Can anyone give some sample i/o for 11335, plzzz? i am getting WA
![:cry:](./images/smilies/icon_cry.gif)
![:cry:](./images/smilies/icon_cry.gif)
Re: need sample i/o
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.deena sultana wrote:Can anyone give some sample i/o for 11335, plzzz? i am getting WA
Re: need sample i/o
and also it would be more helpful if you describe your algorithm first!!deena sultana wrote:Can anyone give some sample i/o for 11335, plzzz? i am getting WA
Hint: consider x and y component separately.
-
- New poster
- Posts: 36
- Joined: Mon Jun 19, 2006 5:43 pm
- Location: Bangladesh
- Contact:
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?
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?
By distance, do you mean the Manhattan distance or the Euclidean distance?ds wrote:the object will move at the position from where the distance of the thief's current position (at t=1) is minimum
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?
-
- New poster
- Posts: 36
- Joined: Mon Jun 19, 2006 5:43 pm
- Location: Bangladesh
- Contact:
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.deena sultana wrote:ops sorry for my incomplete description
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?)
-
- New poster
- Posts: 36
- Joined: Mon Jun 19, 2006 5:43 pm
- Location: Bangladesh
- Contact:
-
- New poster
- Posts: 36
- Joined: Mon Jun 19, 2006 5:43 pm
- Location: Bangladesh
- Contact:
Is this problem solvable using Dynamic Programming? ![:oops:](./images/smilies/icon_redface.gif)
![:oops:](./images/smilies/icon_redface.gif)
Runtime errors in Pascal are reported as Wrong Answers by the online judge. Be careful.
Are you dreaming right now?
http://www.dreamviews.com
Are you dreaming right now?
http://www.dreamviews.com
Re: 11335 - Discrete Pursuit
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.
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
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.
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.
Runtime errors in Pascal are reported as Wrong Answers by the online judge. Be careful.
Are you dreaming right now?
http://www.dreamviews.com
Are you dreaming right now?
http://www.dreamviews.com