QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 512 MB Points totaux : 100

#12164. Kingdom

Statistiques

Once upon a time, in the days of old, there existed a large and wealthy kingdom consisting of $N$ castles where the inhabitants lived. Interestingly, the kingdom was not ruled by one, but by two kings. King East lived in the easternmost castle, while King West lived in the westernmost castle. Unfortunately, the idyllic life of the inhabitants was interrupted by news of a bandit gang rushing toward the kingdom.

Time is running out, and the next two weeks are crucial; it is impossible to fully protect the kingdom without taking drastic measures. With heavy hearts, the kings will choose exactly $K$ castles to further fortify by relocating the inhabitants from the remaining $N - K$ castles. Naturally, the $K$ fortified castles will include the ones where the kings themselves live. Furthermore, they will surround the fortified castles with walls so that they form the convex hull of that set of castles. Note that empty castles may or may not be located inside this convex hull.

Logically, the kings decided to fortify $K$ castles such that the area of the part enclosed by the walls is as large as possible. Determine this area.

Note: The convex hull of a set of points corresponds to the convex polygon of minimum area that contains (on its edges, vertices, or in its interior) all points of that set.

Input

The first line contains the natural numbers $N$ and $K$ ($3 \le K \le N$) from the problem statement.

In the $i$-th of the next $N$ lines, there are two numbers $x_i$ and $y_i$ ($0 \le |x_i|, |y_i| \le 10^9$) which indicate that the $i$-th castle is located at position $(x_i, y_i)$ in the coordinate plane. No two castles will be at the same position.

Also, the first of the mentioned castles corresponds to the castle of King West ($y_1 = 0, x_1 < x_i, i \neq 1$), while the second mentioned castle corresponds to the castle of King East ($y_2 = 0, x_2 > x_i, i \neq 2$). Note that both castles lie on the $x$-axis.

Output

The only line should contain a real number representing the required area from the problem statement.

The area should be printed without leading or trailing zeros. For example, if the required area is $3.14$, outputs like $03.14$ or $3.1400$ will not be accepted.

Subtasks

Subtask Points Constraints
1 11 $3 \le N \le 20$
2 25 $3 \le N \le 100$
3 15 $3 \le N \le 500$
4 49 $3 \le N \le 3\,000$

Examples

Input 1

6 4
0 0
9 0
2 8
6 5
2 -7
8 -7

Output 1

67.5

Note 1

It is optimal to fortify the castles at positions $(0, 0)$, $(2, -7)$, $(2, 8)$, and $(9, 0)$ as shown in the left sketch.

Input 2

5 3
0 0
10 0
5 0
5 5
5 -5

Output 2

25

Note 2

It is optimal to fortify the castles at positions $(0, 0)$, $(10, 0)$, and $(5, -5)$ as shown in the right sketch.

Input 3

8 5
0 0
15 0
2 -2
4 12
10 -14
6 -12
2 -10
13 10

Output 3

238

Figure 1. Left sketch showing the optimal fortification for Note 1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.