eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

UFO Circles

UFO Circles

Recently, British scientists have discovered a huge field of grain on the Mars. They claim that this field is strictly two-dimensional (flat) and spans a nearly infinite area. There are some strange circles on this field, supposedly left by the UFOs. The UFOs are also very strange. When an UFO lands on a grain, the grain in the landing area is burned to ashes. But when an UFO lands on field which is already burned, the \textit{inverse grain} grows instantly in that place. When an UFO lands on \textit{inverse grain} field, it is burned just like normal grain. There were cases of UFO landings on areas with both grain fields and burned fields. In these cases the parts with grain were burned, and \textit{inverse grain} was grown on the other parts. You are hired by the scientists to help them with calculations. They require you to calculate total area of burned fields and total area of fields with \textit{inverse grain}. \InputFile The first line of input will contain the number of circles \textbf{N} (\textbf{1} ≤ \textbf{N} ≤ \textbf{100}). Each of the following \textbf{N} lines contains three integer numbers \textbf{x}, \textbf{y} and \textbf{r}, where \textbf{(x, y)} are the coordinates of circle center and \textbf{r} is the circle radius. All numbers do not exceed \textbf{1000} by absolute value. All circles are different, and all radii are positive. \OutputFile Output should contain two numbers delimited by a space --- the areas you should calculate. These numbers should be accurate to at least three digits after the decimal point. The first number should be the total area of burned fields, the second one should be the total area of \textit{inverse grain}.
Ліміт часу 0.75 секунд
Ліміт використання пам'яті 256 MiB
Вхідні дані #1
2
0 0 5
0 3 1
Вихідні дані #1
75.398224 3.141593
Джерело Izhevsk STU Contest, Petrozavodsk training camp, February 6, 2009