#P8212. Minimum Area of an Inscribed Convex K-gon

    ID: 21392 Type: Default 1000ms 256MiB

Minimum Area of an Inscribed Convex K-gon

Minimum Area of an Inscribed Convex K-gon

A rich cat, MeowMeow, owns a large garden in Haidian district. The boundary of the garden is formed by an old fence constructed as an $N$-gon (a polygon with $N$ sides). With Christmas approaching, MeowMeow wishes to decorate his garden with $K$ Christmas trees. He believes that planting the trees in "lucky positions" will bring him good fortune. In order to achieve this, he decides on the following criteria:

  • All trees must be positioned on the boundary of the garden.
  • The $K$ trees should divide the perimeter of the garden into equal segments of length \(L = \frac{P}{K}\), where \(P\) is the total perimeter.
  • The convex $K$-gon formed by connecting these trees in the order along the boundary should have the minimum possible area.

Your task is to help MeowMeow by computing the minimum possible area of the convex $K$-gon that can be formed by choosing an appropriate starting position for the first tree. The positions of the trees are determined as follows: choose an offset \(t \in [0,L)\), and then place the trees at distances \(t,\, t+L,\, t+2L, \dots, t+(K-1)L\) along the perimeter (taking modulo the total perimeter if necessary). You are to find the offset \(t\) that minimizes the area of the polygon formed by these points.

Note: All formulas must be represented in \(\LaTeX\) format. For example, the perimeter is given by \(P\) and the segment length is \(L = \frac{P}{K}\).

inputFormat

The input begins with a line containing two integers \(N\) and \(K\) where \(N\) is the number of vertices of the garden and \(K\) is the number of trees to be planted (with \(K \ge 3\)).

Each of the next \(N\) lines contains two real numbers \(x\) and \(y\) representing the coordinates of the vertices of the polygon given in counterclockwise order.

outputFormat

Output a single line containing a real number representing the minimum area of the convex \(K\)-gon formed by the trees. The answer should be accurate up to at least 6 decimal places.

sample

4 4
0 0
1 0
1 1
0 1
0.500000

</p>