CandyCon

0

0 votes
Easy
Problem

Shubh loves to eat a lot of candies. This year Aurora Core team has decided to organise an event called CandyCon in which a participant can win a lot of candies. Shubh decided to take part in this event so he can win a large no. of candies.

The CandyCon consists of a region of 1000 x 1000 points, then 'N' no. of center points of the form (x,y) are chosen and a candy is placed on each of the integral point that was on or inside the circular region of radius R around that chosen center point. Now, the candy that lied on or inside at least two such circular regions is known as Lucky Candy. If a participant can determine the total number of Lucky Candies then he/she will get infinite amount of candies. Shubh wants to win this event, can you help him ?

Input :

  • First line of the input contains an integer 'N' , i.e the total no. of center points.
  • Next N lines contain 3 space separated integers x y R as described in the question above.

Output :

  • A single line containing the total no. of Lucky Candies.

Constraints :

  • 1<=N<=10
  • 1<=x,y,R<=1000
  • The search area for the CandyCon is a square with diagonal points (1,1) and (1000,1000).
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

All of the following 9 points are at or inside atleast 2 circles

(3,5) , (4,4) , (4,5) , (4,6) , (5,3) , (5,4) , (5,5) , (5,6) , (6,4)

Editor Image

?