This page is still under construction.

Parts of this page are still being built. What you see may change.

Firehose

Interview

Time limit2sMemory limit512 MB

Summary
Place k hydrants on a circle of circumference 1000000 so the largest arc-distance from any of H houses to its nearest hydrant is minimized, and report that distance.
Level

Medium7 of 10

Topics
Binary search, Greedy, Sorting, Array
Solved
No attempts yet

Problem

A circular street runs through your neighbourhood. The street is a perfect circle whose circumference is exactly 1,000,0001{,}000{,}000, and there are HH houses (1≤H≤10001 \le H \le 1000) along it.

Every point on the street is identified by its address: the clockwise arc-length from the northernmost point of the circle. The northernmost point has address 00, so every address aa satisfies 0≤a<1,000,0000 \le a < 1{,}000{,}000. No two houses share an address.

Your special fire hoses run along the curve of the street, so the length of hose needed to connect a house to a fire hydrant equals the arc-length between them measured along the street.

You may place kk fire hydrants (1≤k≤10001 \le k \le 1000) anywhere on the street (a hydrant may sit at the same location as a house). Each house is then connected to its nearest hydrant. Place the hydrants so that the maximum hose length over all houses is as small as possible, and report that minimum possible maximum length.

Input

The first line contains the integer HH, the number of houses.

Each of the next HH lines contains one integer, the address of a house (0≤a<1,000,0000 \le a < 1{,}000{,}000). No two houses have the same address.

The following line contains the integer kk, the number of fire hydrants you may place.

Output

Print a single line with the smallest possible value of the maximum hose length, that is, the length of hose that lets every house reach its nearest hydrant when the hydrants are placed optimally.

This value is always a multiple of 0.50.5. Print it as a plain integer when it is a whole number; otherwise print it with a single trailing fractional digit of .5.5 (for example, 5.5).

Examples3

  1. Example 1

    Input
    4
    0
    67000
    68000
    77000
    2
    
    Expected output
    5000
    
  2. Example 2

    Input
    2
    0
    1
    1
    
    Expected output
    0.5
    
  3. Example 3

    Input
    3
    0
    100
    200
    3
    
    Expected output
    0