#P4518. Golden Fleet Attack

    ID: 17764 Type: Default 1000ms 256MiB

Golden Fleet Attack

Golden Fleet Attack

After your excellent performance, the alien invasion has been successfully repelled. Now, the commander JYY has rallied the mighty Golden Fleet, preparing a decisive strike to destroy the alien mothership.

The Golden Fleet consists of n (n ≥ 3) spaceships. After their hyper‐jump near the mothership (located at the origin (0,0)), the ships are scattered on the plane. In order to launch the most devastating attack, JYY demands that all ships reposition onto an attack orbit—a circle centered at (0,0) with radius R—and be arranged evenly along the circumference. In other words, the ships must be positioned at the vertices of a regular n‐gon inscribed in the circle (the order of assignment is arbitrary).

A spaceship can move at one unit distance per unit time (and can pass through each other). Given the current positions of the n spaceships, please help JYY compute the minimum time needed so that every spaceship can reposition onto one of the designated positions on the attack orbit. Note that the minimum time is determined by the spaceship that requires the longest travel distance.

The optimal strategy allows you to choose an arbitrary rotation for the target regular n‐gon. Formally, if the final positions of the ships are (R cos(θ + 2πi/n), R sin(θ + 2πi/n)) for i = 0, 1, …, n−1 (in any order), determine the minimum T such that after moving no more than T units (each spaceship moving along a straight line), all spaceships can be repositioned to these target positions.

Input Constraints: n (n ≥ 3), R > 0, and coordinates may be any real numbers; spaceships might even start at the same position.

inputFormat

The first line contains two numbers: an integer n (the number of spaceships, n ≥ 3) and a positive number R (the radius of the attack orbit).

Then follow n lines, each containing two real numbers xi and yi, representing the coordinates of the i-th spaceship.

outputFormat

Output a single real number: the minimum time needed so that all spaceships can move to the target positions. The answer is considered correct if the absolute or relative error does not exceed 1e-6.

sample

3 10
10 0
0 10
-10 0
10.0000000

</p>