Cheerio Contest 2 P1 - Cow Pasture

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

To accommodate his cows, Farmer Bob is planning to build a new pasture, which will be circular and centered at point (X,Y). To ensure that the cows have enough food to eat, the pasture must contain at least M patches of grass (each patch is either on the edge or completely inside the pasture). Luckily, Farmer Bob knows the location of N patches of grass, each of which being located at point (xi,yi). Can you determine the smallest possible radius of the pasture that satisfies the constraints?

Constraints

For all subtasks:

  • 1MN5×105
  • 104X,Y,xi,yi104
Points Awarded Additional Constraints
5 points M=1
10 points No further constraints

Input Specification

The first line of input contains four integers X, Y, N and M.

The next N lines each contain two integers xi and yi, the coordinates of the ith patch of grass.

Output Specification

Output the smallest possible radius of the pasture. Your answer will be considered correct if it is within 108 (8 decimal places) of the correct answer.

Sample Input

Copy
1 -1 6 6
2 5
-3 -3
3 0
3 0
-2 2
1 -1

Sample Output

Copy
6.08276253

Comments

There are no comments at the moment.