Draw A Perfect Circle
Time limit1sMemory limit1024 MB
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 points, and the width of the band that contains the points, , is given.
The accuracy is computed as follows.
- For any radius , define as the number of points whose distance from the origin is at least and at most . (The distance between two points with x-coordinate difference and y-coordinate difference is defined as .)
- The accuracy is , where is a real number.
Help Dongguri draw a perfect circle!
Input
The first line contains two integers () and (), separated by a space. Both and are integers.
The next lines each contain two integers and , the coordinates of the -th point. ()
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 .
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.