Cutting Cheese
Time limit3sMemory limit256 MB
Cut a 100 mm cube with spherical holes into s slices of equal cheese volume perpendicular to the z axis and print each thickness.
- Level
Medium6 of 10
- Topics
- Binary search, Geometry, Math
- Solved
- No attempts yet
Problem
A cheese processing company built a machine that cuts a spherical cheese into slices of exactly equal weight. The next target is Swiss cheese, which has holes in it.
A cheese such as Emmentaler contains holes of different sizes. A slice with many holes holds less cheese, so it weighs less. The problem is how to cut a cheese with holes into slices of equal weight.
Sonar scanning locates the holes down to micrometer precision. In this problem every hole is a perfect sphere. The cheese has uniform density, so the weight of a slice is proportional to the volume of cheese in it.
An uncut block is a cube millimeters on each side. Cut it into slices of equal weight. Every slice is millimeters wide and millimeters high, and you have to determine the thickness of each slice.
Input
The first line contains the number of holes and the number of slices , where and .
Each of the next lines contains four positive integers , , , and describing one hole. Here is the radius and is the center, all measured in micrometers.
The block occupies the points with that belong to no hole. The cuts are perpendicular to the axis.
Holes do not overlap, but they may touch each other. Every hole lies entirely inside the cheese and may touch its boundary.
Output
Print the thickness of each of the slices in millimeters, one per line, starting from the end of the block.
Round each thickness to nine places after the decimal point and print exactly nine digits after the decimal point.