시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 1 1 1 100.000%

문제

Last time I visited Shanghai I admired its beautiful skyline. It also got me thinking, ”Hmm, how much of the buildings do I actually see?” since the buildings wholly or partially cover each other when viewed from a distance.

In this problem, we assume that all buildings have a trapezoid shape when viewed from a distance. That is, vertical walls but a roof that may slope. Given the coordinates of the buildings, calculate how large part of each building that is visible to you (i.e. not covered by other buildings).

입력

The first line contains an integer, N (2 ≤ N ≤ 100), the number of buildings in the city. Then follows N lines each describing a building. Each such line contains 4 integers, x1, y1, x2, and y2 (0 ≤ x1 < x2 ≤ 10000, 0 < y1, y2 ≤ 10000). The buildings are given in distance order, the first building being the one closest to you, and so on.

출력

For each building, output a line containing a floating point number between 0 and 1, the relative visible part of the building. The absolute error for each building must be < 10−6.

예제 입력

4
2 3 7 5
4 6 9 2
11 4 15 4
13 2 20 2

예제 출력

1.00000000
0.38083333
1.00000000
0.71428571

예제 입력 2

5
200 1200 400 700
1200 1400 1700 900
5000 300 7000 900
8200 400 8900 1300
0 1000 10000 800

예제 출력 2

1.00000000
1.00000000
1.00000000
1.00000000
0.73667852

힌트

Figure 1: Figure of the first sample case