#P3187. [HNOI2007] 最小矩形覆盖
[HNOI2007] 最小矩形覆盖
Description
Given the coordinates of several points, find the rectangle with the minimum area that covers all the points. Output the area of the rectangle and the coordinates of its four vertices.
Input Format
The first line contains an integer . From line to line , each line contains two floating-point numbers (with up to five decimal places, not in scientific notation), representing the and coordinates of a point.
Output Format
The first line contains a floating-point number, which is the area of the rectangle. The next lines each contain the coordinates of a vertex, output in counterclockwise order.
6
1.0 3.00000
1 4.00000
2.0000 1
3 0.0000
3.00000 6
6.0 3.0
18.00000
3.00000 0.00000
6.00000 3.00000
3.00000 6.00000
0.00000 3.00000
Hint
, coordinate range . It is guaranteed that the minimum rectangle area needed to cover all points is at least .
If your rectangle area is , and the correct answer is , then your answer will be judged correct when , and all points are inside the rectangle or have distance to the rectangle (you can ignore this paragraph; in short, your answer will pass as long as the numerical error is not particularly large).
Thanks to @intruder for providing the problem summary.
Translated by ChatGPT 5
京公网安备 11011102002149号