I solved the problem geometrically in Microsoft VS C ++. At first, my solution was WA 8, but after I added 100 to the input coordinates, I started getting WA 38. But as I did not try to work with accuracy, I still got WA 38. I tried everything. Please tell me, is 38 test really drawn up correctly? Or at least tell me what my mistake is. I would like to see a test similar to 38. I am sure that I solved the problem correctly
I try to solve different polygons that i feign myself. And everything is OK include some special cases like two equal points or all points in the same line. But when i try to submit solution test number 2 break all my hopes. What is the input data for test 2 and expected answer?
My solution is geometrical, it passes all of my tests, except of one, where one side has a length of 0. But I got WA on test #2, so: 1) Can a polygon have a side with length of 0? 2) Can somebody give me any tests for this problem?
1) I'm pretty sure it can't, since otherwise my AC solution has a big chance to divide by zero. 2) 3 0 0 3 0 0 3 answer: 1.9308 Yeah, this is a pretty simple test but it actually helped me to overcome that WA #2.
1.) We consider polygon such what it is, we spend 2 straight linees in parallel OX, one passes through the lowermost point, another through the uppermost. We spend a third - a line of a break on middle between a theme to two. We look at fragments. If the area of the top fragment is more, then we lift a line of a break on 1/4 all intervals, else is lowered. Then shift on 1/8 etc. To put it briefly, binary search we find height of a horizontal that it divided into equal fragments.
2.) We turn a figure, concerning any fixed point on a small corner (about 0.01 radian)
3.) We carry out action number 1.
And so we shall consider all possible variants. Certainly sooner or later it is necessary to stop to rotate a figure. It at turn on 180 degrees from an initial arrangement of a figure.
My solution differs from yours one, but I think your idea is interesting. I've solved it in a classical way using 2 binary searches - the first one inside the second, and then just a constants optimization...
This problem contains one unobvious and unpleasant trick. In statement it is said that result must be output with "accuracy to 0.0001". But in fact you must output result rounded up to fourth digit after decimal point. So, if you output answer with some additional precision, you'll get WA. For example, I got "Accepted" when corrected line writeln (finres:0:5); to writeln (finres:0:4); in my program.