Neighborhood Watch X77609


Statement
 

pdf   zip

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 NN, the number of the cameras, 1N500001 \leq N \leq 50000.

ii-th of the following NN lines contains four integers xix_i, yiy_i, lil_i, rir_i, where xix_i and yiy_i are coordinates of the ii-th camera, in Measharan meters. Victor’s house has coordinates (0,0). This camera can see lil_i degrees to the left and rir_i degrees to the right from the house. Constraints: 1000xi,yi1000-1000 \leq x_i, y_i \leq 1000, 1li,ri901 \leq l_i, r_i \leq 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.

Public test cases
  • Input

    4
    3 3 45 45
    -2 1 90 90
    0 -7 45 90
    -5 0 90 90
    

    Output

    5
    53.0
    
  • Information
    Author
    Eryk Kopczynski
    Language
    English
    Official solutions
    Unknown.
    User solutions
    C++