ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1202. Rectangles Travel

WA 8
Posted by Giorgi Saghinadze (Tbilisi SU) 6 Aug 2008 20:27
This problem seems easy , but I have WA on test 8, does anybody know what kind of test is this?
Re: WA 8
Posted by svr 22 Nov 2011 13:51
May be greedy wrong?
My solution based on greedy.
Starting from p1=(1,1) we go to nearest(in x+y metric) admissible p2 and so on.
I have wa 9.

Yes!. Greedy is right.
Proof: Let p3 be another admissible point.
We have:
Dist(p1,p2)<=Dist(p1,p3)-Dist(p2,p3);
Dist(p2,n)<=Dist(p3,n)+Dist(p2,p3);
=>
Dist(p1,p2)+Dist(p2,n)<=Dist(p1,p3)+Dist(p3,n)

Edited by author 22.11.2011 14:35