Cowpproximation

시간 제한4초메모리 제한1024 MB

요약
중심과 반지름이 정해진 원들이 주어질 때, 각 원을 시간 t만큼 키웠을 때 한 점에서 모두 만나게 되는 최소 시간 t를 구한다.
난이도

보통10점 중 7점

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

문제

There are cows in a 22 by 22 kilometer field. The cows want to have a group meeting, and all of them must attend! It is up to you to plan the meeting to take place as soon as possible.

To model this problem, we approximate each cow as a circle, and for our purposes, there are no collisions — cows can pass through each other freely.

The ii-th cow is represented by its initial position (x_i,y_i)(x\_i , y\_i) and its radius r_ir\_i, all distances are measured in meters. You can tell each cow to travel in any direction from its initial position at a constant speed from 00 to 11 meter per second. The meeting takes place as soon as all cows occupy the same point in the plane, i.e., there exists a point contained within all circles representing the cows. Find the minimum time in seconds required for the cows to meet.

입력

The first input line contains a single integer NN (1≤N≤1031 ≤ N ≤ 10^3), representing the number of cows. Each of the following NN lines contains three space separated integers x_ix\_i, y_iy\_i, r_ir\_i, describing a cow, where −103≤x_i,y_i≤103-10^3 ≤ x\_i , y\_i ≤ 10^3 and 1≤r_i≤1031 ≤ r\_i ≤ 10^3.

출력

Output the minimum time TT in seconds after which all the cows meet. Your answer will be considered correct if it has an absolute or relative error at most 10−510^{-5}. Formally, let T_OPTT\_{OPT} be the optimal value. Then your answer is considered correct if either ∣T−T_OPT∣≤10−5|T - T\_{OPT}| ≤ 10^{-5} or ∣T−T_OPTmax⁡1,T_OPT∣≤10−5\left| \frac{T - T\_{OPT}}{\max\\{1,T\_{OPT}\\}} \right| ≤ 10^{-5} holds.

예제2

  1. 예제 1

    입력
    2
    -10 3 2
    10 3 4
    
    예상 출력
    7.0000000
    
  2. 예제 2

    입력
    3
    -4 -4 1
    6 0 3
    0 8 5
    
    예상 출력
    3.7039181