Dome of the Circus
Time limit1sMemory limit128 MB
Given 3D points, find the minimum-volume cone with apex on the z-axis and base on the ground plane that contains all points, then output its height and radius.
- Level
Hard8 of 10
- Topics
- Binary search, Geometry, Math
- Solved
- No attempts yet
Problem
A travelling circus needs to design the dome for its aerial performances. Various rigs, supports, and anchors are installed in the air above the stage, and the dome must rise above the centre of the stage in the shape of a cone and cover all of them. Because the space under the dome must be air-conditioned, the dome should enclose the smallest possible volume.
You are given points in space. The point is the position of the -th object that must be covered, for . The ground is the plane , with positive pointing up, and the centre of the stage is the origin .
The tip of the dome is a point with . The dome is a cone whose base is the circle of radius centred at on the ground. Every given point must lie inside or on the surface of the cone. Among all such cones, find the one with the smallest volume.
Input
The first line contains a single integer () — the number of points to cover. Each of the next lines contains three floating-point numbers , , and — the coordinates of the -th point. Every coordinate has absolute value at most and at most two digits after the decimal point. Every is positive, and at least one point has a non-zero or .
Output
Print two numbers and separated by a single space: the height and the base radius of the minimum-volume dome. Print each value rounded to exactly three digits after the decimal point (for example, 3.000). The optimal dome is unique, so both values are uniquely determined.