#P3187. [HNOI2007] 最小矩形覆盖

    ID: 2236 远端评测题 1000ms 500MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2007湖南枚举,暴力凸包旋转卡壳

[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 nn. From line 22 to line n+1n+1, each line contains two floating-point numbers (with up to five decimal places, not in scientific notation), representing the xx and yy coordinates of a point.

Output Format

The first line contains a floating-point number, which is the area of the rectangle. The next 44 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

3n500003 \le n \le 50000, coordinate range [0,10]\in [0, 10]. It is guaranteed that the minimum rectangle area needed to cover all points is at least 0.10.1.

If your rectangle area is SS', and the correct answer is SS, then your answer will be judged correct when SSmax{1,S}<104\frac{|S' - S|}{\max\{1, S\}} < 10^{-4}, and all points are inside the rectangle or have distance <104< 10^{-4} 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