#P1034. [NOIP 2002 提高组] 矩形覆盖

[NOIP 2002 提高组] 矩形覆盖

Description

On the plane, there are nn points, each represented by a pair of integer coordinates. For example, when n=4n=4, the coordinates of the 4 points are p1(1,1)p_1(1,1), p2(2,2)p_2(2,2), p3(3,6)p_3(3,6), p4(0,7)p_4(0,7); see Figure 1.

These points can be fully covered by kk rectangles whose sides are parallel to the coordinate axes. When k=2k=2, two rectangles s1,s2s_1, s_2 as in Figure 2 can cover them, and the sum of their areas is 44. Given the nn points and kk, how can we make the sum of the areas of the kk rectangles that cover all points as small as possible?

Conventions: A rectangle covering a single point has area 00; a rectangle that degenerates to a line segment parallel to a coordinate axis also has area 00. 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 n,kn, k, as described above.

The next nn lines each contain two integers xi,yix_i, y_i, where the (i+1)(i+1)-th line gives the coordinates of the ii-th point.

Output Format

Output a single integer: the minimum possible sum of the areas of the kk rectangles that satisfy the conditions.

4 2
1 1
2 2
3 6
0 7

4

Hint

For 100%100\% of the testdata, 1n501 \le n \le 50, 1k41 \le k \le 4, 0xi,yi5000 \le x_i, y_i \le 500.

Source: NOIP 2002 Senior, Problem 4.

Translated by ChatGPT 5