#P5571. [CmdOI2019] 高塔与晶石

[CmdOI2019] 高塔与晶石

Background

Warm reminder: Please pay attention to the impact of constant factors on program efficiency + the special memory limit of this problem.

In the Kingdom of Geometry, there stand nn ancient towers. Legend says they are the guardians of this pure land.

As geometry develops rapidly day by day, the kingdom’s prosperity attracts a terror from the depths of blazing flames: the moving point PP.

Before the hero Descartes, who can tame the “moving-point dragon,” appears, the lord of the Kingdom of Geometry decides to hold the line in the field of static geometry.

Problem Description

He obtained three “wisdom crystals” of static geometry (of course, they contain god-level math problems), and he can place them into the towers.

Three towers with crystals placed can protect the interior of the triangle they form from invasion.

However, if the area of the triangle formed by the crystals is too large, the defense line will be very easy to break.

If the area of the triangle is too small, the geometric energy generated inside will not be enough to keep the crystals running.

After several days of calculation, the lord believes that among the (n3)\binom{n}{3} possible choices, the plan with the kk-th smallest area is the most suitable.

(The triangle area can be 00.)

He is still not confident about this result, so he asks you—who can crush countless geometry problems with one hand—to help him compute the exact value of this area.

Input Format

The first line contains two integers n,kn,k, with the meanings as described in the statement.

The next nn lines: the ii-th line contains two numbers xi,yix_i,y_i, representing the coordinates of tower ii.

Output Format

Output twice the area corresponding to the plan with the kk-th smallest area. It is easy to prove that this must be an integer.

4 3
2 3
3 4
4 3
3 1
3

Hint

subtask ID n Notes Score Time Limit
1 200 - 15 1S
2 500 k10k\leq10 20
3 k10000k\leq10000 15
4 800 - 50 2S

Constraints: 1xi,yi1061\leq x_i,y_i \leq 10^6, all coordinates are positive integers, and no two towers share the same coordinates.

Sample explanation:

Translated by ChatGPT 5