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 1405. Goat in the Garden 5

Lomir Please Help WA 16 [4] // Problem 1405. Goat in the Garden 5 1 Feb 2007 02:15
Firstly i calculate the longest rope lenths at each tree.
Then just try to tether goats to every tree, calculating the square.
If sum of 2 maxrope are larger then lenght between trees:
double maxrad = std::max(maxr[i], maxr[j]);
double minrad = l - maxrad;
if (minrad < 1.0)
{
    maxrad = maxrad - (1 - minrad);
    minrad = 1.0;
}
if (maxrad >= 1.0)
maxsize = std::max(maxsize, square(maxrad)+sqree(minrad));
KIRILL(ArcSTU) Re: Please Help WA 16 [3] // Problem 1405. Goat in the Garden 5 1 Feb 2007 03:53
Try this test
4
0 0
5 0
6 0
6.5 0

Right answer is 53.4071
Lomir Re: Please Help WA 16 [1] // Problem 1405. Goat in the Garden 5 1 Feb 2007 06:05
Thx, really nice test.
Now AC :)
Denis Koshman Re: Please Help WA 16 // Problem 1405. Goat in the Garden 5 5 Aug 2008 05:47
Yeah... I was caught by that too :))
crossheart Re: Please Help WA 16 // Problem 1405. Goat in the Garden 5 5 Dec 2012 08:22
pretty nice test