Neighborhood Watch X77609


Statement
 

pdf   zip

html

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

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 xi, yi, li, ri, where xi and yi are coordinates of the i-th camera, in Measharan meters. Victor’s house has coordinates (0,0). This camera can see li degrees to the left and ri degrees to the right from the house. Constraints: −1000 ≤ xi, yi ≤ 1000, 1 ≤ li, ri ≤ 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. This problem is being checked.
    User solutions
    C++