Attractions On Plane
Time limit2sMemory limit512 MB
Given N rectangles above the x-axis, find for each one the fraction of the segment from (0,0) to (X,0) during which it is the closest attraction.
- Level
Hard8 of 10
- Topics
- Geometry, Divide and conquer
- Solved
- No attempts yet
Problem
You are going on a trip on the Cartesian plane. Starting at and going to at constant speed, you view attractions. Each attraction is a rectangle with its base at , width , and height . Attractions can overlap.
The distance from you to an attraction is the Euclidean distance from you to its closest point. The attraction with the minimum distance is the Star Attraction. If several attractions share the minimum distance, the one with the lower index is the Star Attraction (it has the better rating).
For each attraction, find the percentage of the trip during which it is the Star Attraction.
Input
The first line contains two integers and (, ).
Each of the next lines contains four integers , , , and (, ).
Output
Output lines. On line , print the percentage of time that attraction is the Star Attraction. An answer is accepted if its absolute or relative error is at most .