Neighborhood Watch

Victor Zynoulus is crazy about security! He has placed several security
cameras around his house. They record everything which happens nearby.

[image]

However, Victor’s cameras have wide angle lens. They guard not only
Victor’s house, but also everything within an angle.

Victor is thinking whether he could somehow sell his security to his
neighbors for a profit. The security must be top quality, so he wants to
know how much area is covered by all of his cameras. This region is a
polygon; he also wants to know the number of vertices of this polygon.

Input

The first line contains N, the number of the cameras, 1 ≤ N ≤ 50000.

i-th of the following N lines contains four integers x_(i), y_(i),
l_(i), r_(i), where x_(i) and y_(i) are coordinates of the i-th camera,
in Measharan meters. Victor’s house has coordinates (0,0). This camera
can see l_(i) degrees to the left and r_(i) degrees to the right from
the house. Constraints: −1000 ≤ x_(i), y_(i) ≤ 1000,
1 ≤ l_(i), r_(i) ≤ 90.

It is guaranteed that the region seen by all the cameras is bounded.

Output

Output two lines. The first line should be the number of vertices of the
region seen by all cameras. The second line should be the area of this
region, in square Measharan meters, with one digit after decimal point.

Problem information

Author: Eryk Kopczynski

Generation: 2026-01-25T22:31:13.751Z

© Jutge.org, 2006–2026.
https://jutge.org
