Knocked Ink

시간 제한3초메모리 제한512 MB

요약
각기 다른 시각에 생겨 초당 1cm씩 자라는 잉크 방울들이 주어질 때, 합쳐진 넓이가 주어진 값에 처음 도달하는 시각을 구한다.
난이도

어려움10점 중 8점

유형
기하, 이분 탐색, 유니온 파인드, 정렬
정답자
아직 제출이 없습니다

문제

You knocked over the inkwell for the team fountain pen... Now spots of ink are beginning to form on the page and spread out. This is really going to hamper your speed at writing up programming contest solutions.

The ink spreads out by forming infinitesimally-small blots on the page. A blot that appears at time t seconds after the incident grows in radius smoothly, at a rate of 1cm per second, and may eventually overlap with other blots on the page.

At first the page is still usable, but when the combined size of the ink blots grows large enough, you will have to abandon your work and find another piece of paper upon which to type up solutions.

How long will it take for this to happen?

Figure K.1: Illustration of Sample Input 1.

입력

The input consists of:

  • one line with the number of inkblots, n (1 ≤ n ≤ 100), and the real-valued total area of ink in square centimetres at which the paper must be abandoned, a (1 ≤ a ≤ 109).
  • n further lines, each with the x and y coordinates in centimetres of an ink blot (−106 ≤ x, y ≤ 106) and the time in seconds at which the blot first appears, t (0 ≤ t ≤ 106).

출력

Output the time in seconds at which the ink blots cover exactly a square centimetres of the infinitely-large page. Your answer must be accurate to an absolute or relative error of 10−6.

예제3

  1. 예제 1

    입력
    4 20.566371
    0.0 0.0 0.0
    0.0 2.0 0.0
    2.0 0.0 0.0
    2.0 2.0 0.0
    
    예상 출력
    1.4142135624
    
  2. 예제 2

    입력
    2 785.398163397
    -50 0 20
    50 0 30
    
    예상 출력
    35
    
  3. 예제 3

    입력
    5 10000
    0 0 0
    0 0 1
    0 0 2
    10 0 1
    0 -5 2
    
    예상 출력
    53.3322048