I have a small problem with this task...
It loks quite easy but my program always gets WA

I take the smallest and largest values of x and y and count the area of the rectangle...
Are there any tricky inputs or something like that...
Pls Help
Moderator: Board moderators
mm.. I rotate it from -PI~PI using rotation matrix, inc theta by PI/1800Ivan Golubev wrote:I'm not sure about this. My accepted solution computes convex hull and then rotates it from 0 to pi/2 to find smallest possible rectangle.Even wrote:is there always one side of input polygon be the same side of the smallest rectangle ?
May be pi/1800 is not enough precise -- my solution starts from theta == 0.1 and searching for smallest rectangle. Then decreasing theta 10 times and seaching in smaller (founded) interval. This process appling several times and last theta value is about 1e-12.Even wrote:mm.. I rotate it from -PI~PI using rotation matrix, inc theta by PI/1800
Yes, answer must be 0.0000.Even wrote:if only contain two points... the answer should be 0.0000 ?
Output:3
-3.000000 5.000000
17.000000 5.000000
7.000000 9.000000
4
10.000000 10.000000
20.000000 10.000000
20.000000 20.000000
10.000000 20.000000
4
-5.000000 0.000000
0.000000 -5.000000
5.000000 0.000000
0.000000 5.000000
21
211.330000 0.360000
277.690000 0.300000
288.740000 0.440000
327.450000 1.240000
327.630000 122.950000
327.660000 232.820000
319.980000 314.840000
303.210000 326.900000
138.970000 327.310000
91.490000 327.240000
73.410000 327.060000
8.600000 323.920000
7.630000 323.670000
1.520000 289.180000
0.310000 232.200000
0.100000 22.700000
5.770000 6.350000
7.120000 3.800000
80.300000 1.770000
134.550000 0.920000
199.580000 0.410000
1
1.0 1.0
2
3.0 3.0
0 0
3
0 0
1 1
2 2
0
80.0000
100.0000
50.0000
107029.2217
0.0000
0.0000
0.0000
Even wrote:thank Ivan Golubev and Adrian Kuegel...
I starts form theta = 0, inc = 1 to searching for the smallest rectangle.
Then decreasing inc to inc/10, searching in smaller interval...
repeat ...10 times ... WA ... 11 times ... AC
thank you all ....
and If I wanna search the "largest" rectangle...
can I use the same method ?? ...
hmm...only one constrain ... fit tightly ...Google wrote:The largest rectangle is simply infinitely large.
I think your proposition need some more definitions.
Maybe you want to put the constraints on the rectangle that should
have at least a certain number of points on the boundary or something else...I don't know
Sorry for confusing you,jpfarias wrote:How do you find the interval to search next?
JP.