This page is still under construction.

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

Blowing Candles

Time limit4sMemory limit512 MB

Summary
Given up to 200,000 points inside a disk, find the minimum width of a strip that can cover all of them.
Level

Hard8 of 10

Topics
Geometry, Brute force, Sorting, Divide and conquer
Solved
No attempts yet

Problem

Jacques-Édouard likes birthday cakes so much that he celebrates his birthday every hour instead of every year. His friends ordered a round cake from a famous pastry shop and placed candles on its top surface. The number of candles equals his age in hours, so a huge number of candles are burning on the cake. Jacques-Édouard wants to blow all of them out in one single breath.

Think of the flames as points in one plane, all inside a disk of radius RR nanometers centered at the origin. In that same plane, the air he blows travels along a straight strip of width WW, which is the region between two parallel lines at distance WW. Both lines belong to that region. Find the minimum width WW that lets him blow out every candle when he chooses the best orientation.

Input

The first line has the integers NN and RR, separated by a space, where NN is Jacques-Édouard's age in hours. Each of the next NN lines has the two integer coordinates xix_i and yiy_i of the ii-th candle in nanometers, separated by a space.

Limits

  • 3≤N≤2×1053 \le N \le 2 \times 10^5
  • 10≤R≤2×10810 \le R \le 2 \times 10^8
  • xi2+yi2≤R2x_i^2 + y_i^2 \le R^2 for every ii with 1≤i≤N1 \le i \le N
  • All points have distinct coordinates.

Output

Print WW on one line, rounded to exactly six digits after the decimal point. For example, print 20.000000 when the answer is 2020.

Examples2

  1. Example 1

    Input
    3 10
    0 0
    10 0
    0 10
    
    Expected output
    7.071068
    
  2. Example 2

    Input
    4 15
    -10 -10
    10 -10
    10 10
    -10 10
    
    Expected output
    20.000000