Prime Cut 5

View as PDF

Submit solution

Points: 100
Time limit: 6.0s
Memory limit: 256M

Author:
Problem type

Kirby has to set up a space station to survey a set of n stars, each of which has a distinct position (x_i, y_i). To set up a space station, Kirby must choose a position on a cut in spacetime. This cut is a line segment that begins at position (s, 0) and ends at (e,0), meaning that kirby can choose any position on the x axis between s and e for his space station.

The space station will send out a light beam to each star sequentially, starting with star 1, then 2, ... until it sends a signal to star n. When the station sends out a signal to a star i, it takes d_i seconds to reach the star, where d_i is the distance to the star from the space station. the signal then takes d_i seconds to travel back to the space station. Only then can the station send a signal to star i+1.

The amount of time taken to send and receive a signal from every star is a period, and can be expressed as 2d_1 + 2d_2 + 2d_3 ... + 2d_n. Kirby wants to maximise the number of signals sent to stars, so he wants to choose a position for his station such that the period is small as possible. What is the smallest period that can be achieved?

hint: functions of the form f(x) = (x-a)/ sqrt((x-a)^2 + b^2) are monotonically increasing.

Input

The first line has 3 integers n, s, e, (1 \le n \le 1e5) (-1e5 \le s, e \le 1e5), the number of stars, and the start and end points of the cut in spacetime.

n lines follow, each with x_i y_i, the coordinates of a star  -1e5 \le x_i, y_i \le 1e5.

All points are distinct and guaranteed to not be all collinear.

Output

Write 2 integers, the smallest possible period that occurs when kirby chooses the optimal location for a space station and the x-value of the position for which this occurs. Answers with a relative or absolute error less than 1e-6 will be accepted.

Sample Input

Input 1
2 -1000 1000
1 1
2 2
Output 1
6.32455532
Input 2
1 -2000 1000
5 5
Output 2
10
Input 3
7 -10 0
8 3
10 1
0 2
0 8
7 2
0 0
5 10
Output 3
94.10865829

Comments

There are no comments at the moment.