ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

Timus Top Coders: First Challenge

About     Problems     Submit solution     Judge status     Standings
Contest is over

I. Biscuits

Time limit: 2.0 second
Memory limit: 64 MB


Everyone knows that a glass is the most useful thing to make biscuits. It is desirable for a glass to be faceted, but a round one is also acceptable. A glass should be empty, otherwise kids will not be able to eat these biscuits. But popular singer Michael liked kids very much and wanted to invite them to celebrate his birthday at his villa. In fact, he was going to bake some biscuits for them.


Michael prepared dough, then rolled out it on the surface of the table as a circle of radius 32000 with a center at point (0, 0) and finally started to cut biscuits. It must be said that he tried his best and even perspired profusely. Michael had not got any glass, so he used all round objects he could reach - pickle-jars, herring-cans, pots, a collection of beer mugs, and even bottle lids. Over and over again Michael took the next round object of radius R[i], put it on the surface of the dough so that its center was at point with cartesian coordinates X[i] and Y[i]. As a result of each action the next thin round cut appeared on the surface of the dough - an outline of future biscuit.
As soon as the last pot was soiled, and favorite tea-set vanished into the depth of the bin, Michael finally stopped and looked at the result of his work. His eyes grew dim, and his forehead furrowed. The point was that some cuts intersected, so not all of the biscuits were round. Some of them even had holes. But it could not stop Michael, who is going to calculate the number of prepared biscuits.


The first line contains the integer number N (0 ≤ N ≤ 500). Each of the next N lines contains the integer numbers X[i], Y[i] (-10000 ≤ X[i], Y[i] ≤ 10000) and R[i] (1 ≤ R[i] ≤ 10000) for the corresponding cut.


You should output the number of the biscuits prepared by Michael.


-1 0 2
1 0 2
0 0 3
Problem Author: Nikita Rybak, Ilya Grebnov, Dmitry Kovalioff
Problem Source: Timus Top Coders: First Challenge
To submit the solution for this problem go to the Problem set: 1429. Biscuits