#P5571. K-th Smallest Triangle Area
K-th Smallest Triangle Area
K-th Smallest Triangle Area
The lord has acquired three wisdom crystals from the realm of static geometry (indeed, they contain god‐level math problems) and can install them in towers. When the crystals are placed in three towers, the triangle formed by the towers provides protection to the area inside. However, if the triangle's area is too large, the defense line can easily be breached; if it is too small, the resulting geometric energy won’t suffice to power the crystals.
After several days of calculations, the lord decided that among \( \binom{n}{3} \) possible configurations, the configuration with the \( k \)-th smallest triangle area is ideal (note that the triangle area can be \( 0 \)).
Your task is to compute this area given \( n \) points representing the positions of the towers and an integer \( k \).
inputFormat
The first line contains two integers \( n \) and \( k \) where \( 3 \le n \le 100 \) and \(1 \le k \le \binom{n}{3}\).
Each of the following \( n \) lines contains two integers \( x \) and \( y \) (\( -10^4 \le x,y \le 10^4 \)), representing the coordinates of a tower.
outputFormat
Output the area of the triangle in the optimal configuration as a floating-point number. The answer is accepted if its absolute or relative error does not exceed \(10^{-6}\).
sample
4 1
0 0
2 0
0 2
1 1
0.000000