Under construction

Still being built. Things may change

Draw A Perfect Circle

Time limit1sMemory limit1024 MB

Summary
Given N points and a band width K, find the radius R maximizing the number of points whose distance from the origin lies in the band around R, and print the accuracy as a percentage.
Level

Medium7 of 10

Topics
Sorting, Two pointers, Binary search, Geometry
Solved
No attempts yet

Problem

Dongguri is practicing the circle challenge. In this challenge, you swing your arm like a compass and draw a circle on a chalkboard.

Dongguri found it hard to tell how close his drawing is to a circle, so he asked you to write a program that computes its accuracy.

Dongguri's drawing is represented by NN points, and the width of the band that contains the points, KK, is given.

The accuracy is computed as follows.

  • For any radius RR, define cnt(R)cnt(R) as the number of points whose distance from the origin is at least max⁡(0,R−K2)\max(0,R-\frac{K}{2}) and at most R+K2R+\frac{K}{2}. (The distance between two points with x-coordinate difference pp and y-coordinate difference qq is defined as p2+q2\sqrt{p^2+q^2}.)
  • The accuracy is 100N×max⁡R≥0cnt(R)\frac{100}{N}\times \max_{R \ge 0} cnt(R), where RR is a real number.

Help Dongguri draw a perfect circle!

Input

The first line contains two integers NN (1≤N≤200 0001\leq N \leq 200\,000) and KK (1≤K≤20 0001\leq K \leq 20\,000), separated by a space. Both NN and KK are integers.

The next NN lines each contain two integers xix_i and yiy_i, the coordinates of the ii-th point. (−10 000≤xi,yi≤10 000-10\,000 \le x_i, y_i \le 10\,000)

All point positions are guaranteed to be distinct.

Output

Print the accuracy of Dongguri's drawing.

An answer is accepted if its absolute or relative error from the correct answer is at most 10−610^{-6}.

Hint

The absolute error is the difference between the correct answer and your output. The relative error is the absolute error divided by the correct answer.

Examples1

  1. Example 1

    Input
    8 1
    4 3
    -5 0
    -3 3
    4 -1
    0 4
    5 2
    0 -2
    2 -4
    
    Expected output
    75.000000