373. Carlsson vs. Winnie-the-Pooh
Time limit per test: 0.25
Memory limit: 65536
Carlsson and Winnie the Pooh are eating one pizza, which is a circle of radius R
. They divided the pizza into some pieces by N
straight lines. They eat pizza in a following way. Any person takes a piece and eats it, then takes the next piece, eats it and so on. They eat pieces with the same speed. The time of eating a piece is proportional to its area. If at any moment of time they are both trying to take a piece simultaneously, Carlsson does his selection first. Your goal is to write the program, which determines the amounts of pizza eaten by each side, if it is known that both sides try to maximize their total amount of eaten pizza.
The first line of the input contains N
(1 ≤ N
≤ 4) and R
(1 ≤ R
≤ 100). The center of the pizza is located at (0, 0). Each of the next N
lines describes one line with three integers a
(-1000 ≤ a
≤ 1000). These numbers correspond to equation ax
= 0. It is guaranteed that each line intersects the edge of pizza in exactly two points.
Output the area of pizza eaten by Carlsson and by Winnie the Pooh. The testing program checks whether the answer is within 10-4
of the right answer.
1 0 0