Grand Finale: Circles
From Codeforces. Circle geometry. Solve the geometry problem "Grand Finale: Circles".
Examples
Input: [1,2,3]
Output: 0
Input: [2,3,4]
Output: 0
Hints
Find circle C contained in intersection of all given circles with maximum radius. Binary search radius r. Feasibility: does point (x,y) exist such that distance to each center ≤ ri − r?
Feasibility reduces to 1D: for a given r, x-range is intersection of [xi−(ri−r), xi+(ri−r)]. For each x, y-range is intersection of shifted half-circles. Check with ternary search on x.
Problem guaranteed feasible (radius ≥ 1e−6). Use absolute/relative tolerance 1e−7. n up to 1e5 so O(n log precision) is fine. Single ternary search on x suffices — the feasible region is convex.
Grand Finale: Circles
**From Codeforces.** Circle geometry. Solve the geometry problem "Grand Finale: Circles".