#P5916. Optimal Virus Protective Barrier

    ID: 19142 Type: Default 1000ms 256MiB

Optimal Virus Protective Barrier

Optimal Virus Protective Barrier

K Country has discovered (n) unknown viruses simultaneously. Each virus starts infecting the land from its discovered location in an expanding circular manner. At time (t) a virus infects a circular region of radius (t) with center at its discovery point. K Country can be viewed as an infinite two-dimensional plane. Fortunately, the King has access to a unique antivirus barrier that can kill any virus once it comes into contact with it. This barrier is represented by a straight line that can be placed anywhere on the plane. As soon as a virus’s expanding circular infection touches the barrier, the virus dies and the infected area is fixed at that moment. Note that if a virus appears exactly on the barrier, its infected area is (0). Also, if an area is infected by multiple viruses, it is counted once for each virus when summing the total infected area.

Since the barrier can be constructed only once due to its high cost, the goal is to choose the optimal location and orientation of this line such that the average infected area per virus (i.e. the total infected area divided by (n)) is minimized. Each virus is independent, meaning the death of one virus does not interfere with the infection pattern of another.

For a single virus at point ((x_i, y_i)), if the perpendicular distance from the point to the barrier is (d_i), then the infected area is (\pi d_i^2). Therefore, the average infected area is: [ \text{Average Area} = \frac{\pi}{n} \sum_{i=1}^{n} d_i^2. ]

It is known from statistics that for a set of points ({(x_i,y_i)}), the line that minimizes the sum of squared distances (\sum d_i^2) must pass through the centroid ((\bar{x},\bar{y})) of the points. Let (S_{xx}=\sum_{i=1}^{n}(x_i-\bar{x})^2), (S_{yy}=\sum_{i=1}^{n}(y_i-\bar{y})^2), and (S_{xy}=\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y})). Then the eigenvalues of the scatter matrix are given by: [ \lambda = \frac{S_{xx}+S_{yy}\pm \sqrt{(S_{xx}-S_{yy})^2+4S_{xy}^2}}{2}. ]

The minimum total squared distance is the smaller eigenvalue (\lambda_{\min}). Hence, the optimal average infected area is: [ \frac{\pi}{n} \lambda_{\min} \quad \text{where} \quad \lambda_{\min} = \frac{S_{xx}+S_{yy}-\sqrt{(S_{xx}-S_{yy})^2+4S_{xy}^2}}{2}. ]

Your task is to compute and output this optimal average infected area given (n) and the coordinates of the viruses. Output the answer as a real number with at least 10 decimal places of precision.

inputFormat

The first line of input contains an integer (n) ((1 \le n)), the number of viruses. Each of the following (n) lines contains two integers (x_i) and (y_i) representing the coordinates of the (i)-th virus.

outputFormat

Output the optimal average infected area in K Country. Your answer must be a real number with at least 10 decimal places of precision.

sample

1
0 0
0.0000000000