Weird Flecks, But OK
InterviewTime limit3sMemory limit1024 MB
Given 3D points in a cube, find the smallest drill diameter so a bit entering perpendicular to a face removes all points, i.e. the smallest enclosing circle of the points projected onto each of the three coordinate planes.
- Level
Medium5 of 10
- Topics
- Geometry, Binary search, Brute force, Implementation
- Solved
- No attempts yet
Problem
An artist who wanted to create an installation where his works appeared to be floating in midair has cast a large cube of clear acrylic to serve as a base. Unfortunately, during the casting, some small flecks of dirt got into the mix, and now appear as a cluster of pinpoint flaws in the otherwise clear cube.
He wants to drill out the portion of the cube containing the flaws so that he can plug the removed volume with new, clear acrylic. He would prefer to do this in one drilling step. For stability's sake, the drill must enter the cube perpendicular to one of its faces.
Given the positions of the flaws, and treating the size of the flaws as negligible, what is the smallest diameter drill bit that can be used to remove the flaws in one operation?
The drill may enter any one of the cube faces, but must be positioned orthogonally to the face.
Input
The first line of input will contain an integer denoting the number of flaws.
This is followed by lines of input, each containing three real numbers in the range , denoting the coordinates of a single flaw. Each number will contain at most digits following a decimal point. The decimal point may be omitted if all succeeding digits are zero.
Output
Print the diameter of the smallest drill bit that would remove all the flaws.
The answer is considered correct if the absolute or relative error is less than