#P1034. [NOIP 2002 提高组] 矩形覆盖
[NOIP 2002 提高组] 矩形覆盖
Description
On the plane, there are points, each represented by a pair of integer coordinates. For example, when , the coordinates of the 4 points are , , , ; see Figure 1.

These points can be fully covered by rectangles whose sides are parallel to the coordinate axes. When , two rectangles as in Figure 2 can cover them, and the sum of their areas is . Given the points and , how can we make the sum of the areas of the rectangles that cover all points as small as possible?
Conventions: A rectangle covering a single point has area ; a rectangle that degenerates to a line segment parallel to a coordinate axis also has area . The rectangles must be pairwise disjoint; they may not overlap or even touch (edges and vertices may not coincide).
Input Format
The first line contains two integers , as described above.
The next lines each contain two integers , where the -th line gives the coordinates of the -th point.
Output Format
Output a single integer: the minimum possible sum of the areas of the rectangles that satisfy the conditions.
4 2
1 1
2 2
3 6
0 7
4
Hint
For of the testdata, , , .
Source: NOIP 2002 Senior, Problem 4.
Translated by ChatGPT 5
京公网安备 11011102002149号