Roads in a City
Time limit8sMemory limit512 MB
Given road segments with capacities, compute the area inside the square from -5 to 5 that lies within distance r of at least one segment.
- Level
Medium7 of 10
- Topics
- Geometry, Implementation
- Solved
- No attempts yet
Problem
Roads in a city play an important role in its development. Once a road is built, people start living around it. A broader road has a larger capacity, so people can live in a wider area around it.
The Interstellar Conglomerate of Plantation and Colonization (ICPC) plans to build roads on a new territory. The territory is a square and is completely clear. ICPC has several plans but finds it hard to judge which one is best.
So ICPC asked several programmers, including you, to write programs that compute metrics for each plan. Your task is fairly simple: given the locations and capacities of the roads, compute the area where people can live.

Figure 1: The first plan
Input
The input consists of several plans. The first line of each plan gives the number of roads (). The next lines each contain five integers , , , , and , separated by spaces. and are the endpoints of a road segment (), and is the capacity, the maximum distance from the road at which people can live ().
The input ends with a line containing only 0.
The territory lies in . Each road is a straight line segment, and no segment degenerates. You may assume this.
Output
For each plan, print the area where people can live on one line. You may print any number of digits after the decimal point, as long as the difference from the exact answer is at most 0.01.