#P5252. Abbi’s Telescope Adjustment
Abbi’s Telescope Adjustment
Abbi’s Telescope Adjustment
Abbi, a single deer with a long neck, loves to watch the fireworks display from afar using her telescope. However, she must adjust the telescope so that every firework is completely visible in its field of view. The night sky is approximated by a plane. The i-th firework is represented by a circle with center \((x_i,y_i)\) and radius \(r_i\), and the telescope's view is also modeled as a circle.
To capture every firework entirely, the telescope’s view (a circle with center \((X,Y)\) and radius \(R\)) must satisfy that for every firework \(i\):
[ \sqrt{(X-x_i)^2+(Y-y_i)^2}+r_i\le R, ]
Abbi wishes to minimize \(R\) so that the view is as tight as possible while still containing every firework. Your task is to compute the optimal \((X,Y)\) and the minimal \(R\).
Note: The input values are real numbers, and your answer will be considered correct if each number is within an absolute or relative error of \(10^{-6}\) of the correct answer.
Below is an illustration for reference:
Note: '望远镜' means telescope.
inputFormat
The first line contains a single integer \(n\) indicating the number of fireworks.
Each of the following \(n\) lines contains three real numbers \(x_i\), \(y_i\), and \(r_i\), which represent the center coordinates and radius of the \(i\)-th firework.
outputFormat
Output three real numbers separated by spaces: \(X\) (the x-coordinate of the telescope's view center), \(Y\) (the y-coordinate), and \(R\) (the minimal required radius). The answer is accepted if each number is within an absolute or relative error of \(10^{-6}\).
sample
3
0 0 1
2 0 1
1 2 1
1.000000 1.000000 2.000000