|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||0||0||0||0.000%|
Gwen has painted some rectangles with completely black surfaces on a large sheet of graph paper. To ensure that everything looks neat and tidy, all of her rectangles’ edges lie on the lines of the paper. Now she intends to take a photo of the paper while spinning it very fast. The exposure time of the camera is long enough to cover an entire rotation of the plane. In the resulting photo, areas covered by rectangles throughout the entire rotation will appear black, whereas areas never covered by a rectangle will appear white. The remaining “blurry” areas may vary in brightness, but Gwen simply considers all of those to be grey.
Now, before taking the photo, Gwen tells you the coordinates of the rectangles she has painted and asks you to determine how much of the photo’s surface area will be black and how much of it will be grey.
Figure L.1: The first sample input and the resulting photo.
The input consists of:
The plane is rotated around the origin (0, 0), and you may safely assume that the entire sheet of paper is fully captured by the camera throughout the entire rotation.
Output two real numbers, the first being the area of the black and the second being the area of the grey portion of the photo’s surface. A number is considered correct if its absolute or relative error does not exceed 10−6.
4 -2 1 4 1 -2 -2 1 4 -2 -2 4 1 1 -2 1 4
1 0 0 2 2