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 1647. Divide an Island!

try this test:
Posted by Victor Barinov (TNU) 25 Oct 2008 21:11
Hi everybody! Please run your AC programs on this test:

0 0 1000 1 2000 0

And post you result with name of compiler you use.

Thank you!
Re: try this test:
YES
999.999499737564410 0.999999499737564
1000.000500262685700 0.000000000000000

P.S. Compiler - VS C++. My prog got AC

Edited by author 25.10.2008 21:24
Re: try this test:
Posted by Victor Barinov (TNU) 25 Oct 2008 21:48
Thanks!
But it is incorrect answer. Precision is not enough. I think jury must change precision to 1e-3 or add this test and make rejudge...

Edited by author 25.10.2008 21:53
Re: try this test:
Correct - my solution is analytical. Think why this is another correct answer but obvious "1000 0 1000 1".
Re: try this test:
Posted by Victor Barinov (TNU) 25 Oct 2008 21:59
It is analytical but not so exact. Actually some analytical solution can use more square root and so on and give not so exact result... If this test will be added (and some similar) than many AC solution will fail.
Re: try this test:
What means "Not so exact"???

Perimeter of one part - 2000.0004999998749789068277343249
Perimeter of another part - 2000.0004999998750212181721875511

Area of one part - 499.9999999999997186851059078174
Area of another part - 500.0000000000002813148940921826

Don't you see some similarity in them? Up to 10^-12!
Re: try this test:
Posted by Victor Barinov (TNU) 25 Oct 2008 22:13
Thank you.
Now I understood that in this case we have 3 solution one of them:
1000 0 1000 1 - the median of triangle
and 2 another similar to your result.

Sorry for flood
Re: try this test:
Posted by Elmurod 30 Oct 2008 23:03
Victor Barinov (TNU) Help me please I choose method with median... but i have WA#2

#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double x1,y1,x2,y2,x3,y3,a,b,c;
double X1,X2,Y1,Y2,X,Y,X0,Y0;
cout.precision(15);
cout.setf(ios::fixed);
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
a = sqrt((double)pow(x1-x2,2)+pow(y1-y2,2));
b = sqrt((double)pow(x1-x3,2)+pow(y1-y3,2));
c = sqrt((double)pow(x2-x3,2)+pow(y2-y3,2));
// Finding big side of triangle
if (a > b && a > c)
{
X1 = x1; Y1 = y1; X2 = x2; Y2 = y2;
X0 = x3; Y0 = y3;
}
else if (b > a && b > c)
{
X1 = x1; Y1 = y1; X2 = x3; Y2 = y3;
X0 = x2; Y0 = y2;
}
else if (c > a && c > b)
{
X1 = x2; Y1 = y2; X2 = x3; Y2 = y3;
X0 = x1; Y0 = y1;
}
X = (X1 + X2) / 2; Y = (Y1 + Y2) / 2;
cout<<"YES"<<endl<<X0<<" "<<Y0<<endl;
cout<<X<<" "<<Y;
return 0;
}
Re: try this test:
Posted by d6d0d1a8 1 Nov 2008 10:52
Why the segment ST can be the middle-line of the triangle.
If a is the longest edge and b is not equal with c, the solution can work out a right answer?