Hide

Problem B
Marathon

Next weekend, it’s time for the Codeville Ultramarathon, a $5\, 000$ kilometer race only for the sportiest of programmers. As it happens, you are responsible for organizing the medical coverage for the marathon.

For simplicity, the race track can be seen as a single long line segment. Along the track there are $N$ water stations. At each station, a nurse is placed in order to quickly respond to a medical emergency. If something happens, they will travel on their bicycle to the emergency at a pace of one second per meter.

The organizers of the marathon want to cut costs to save money for all the upcoming programming contests. They have asked you if you really need a nurse at every water station. Thinking as a computer scientist, you realize that it’s really only the worst-case medical emergency that matters. This means minimizing the longest time it would take to respond to an emergency at any point on the track. It may be that you could remove some nurses, and not make this worst-case time any worse.

Prepare a report for the organizers containing the current worst-case medical emergency response time for the track, as well as the number of non-essential nurses – i.e. those that can be removed while not making that time worse.

Input

The first line contains an integer $N$ ($1 \le N \le 1\, 000\, 000$) – the number of water stations where a nurse is stationed.

The next line contains $N$ integers in increasing order – the positions of the water stations. The positions are given in meters from the start of the race. Each water station is located on the race track.

Output

Output a line with two numbers. First, the longest time it would take for a nurse to reach every point on the race track. Output it in decimal form with exactly one digit after the decimal point.

Then, the number of nurses that can be removed without making this time worse.

Sample Input 1 Sample Output 1
2
0 5000000
2500000.0 0
Sample Input 2 Sample Output 2
2
0 4999999
2499999.5 0
Sample Input 3 Sample Output 3
5
1000000 1500000 3000000 3500000 4000000
1000000.0 2

Please log in to submit a solution to this problem

Log in