AlgoUniversity
  • Go Back
Discussion
Maximum Bombs :

Author

Ujjwal Srivastava

Difficulty Level : Easy

Submissions : 942

Asked In : Google

Marks :10

: 11 | : 0

You are given a list of bombs. The range of a bomb is defined as the area where its effect can be felt. This area is in the shape of a circle with the center as the location of the bomb.

The bombs are represented by a $$$0$$$-indexed $$$2D$$$ integer array bombs where $$$bombs[i] = [x_{i}, y_{i}, r_{i}]$$$. $$$x_{i}$$$ and $$$y_{i}$$$ denote the $$$X$$$-coordinate and $$$Y$$$-coordinate of the location of the $$$i_{th}$$$ bomb, whereas $$$r_{i}$$$ denotes the radius of its range.

You may choose to detonate a single bomb. When a bomb is detonated, it will detonate all bombs that lie in its range. These bombs will further detonate the bombs that lie in their ranges.

Given the list of bombs, return the maximum number of bombs that can be detonated if you are allowed to detonate only one bomb.

Input

The first line contains an integer $$$n$$$ denoting the number of bombs. The next $$$n$$$ line contains $$$3$$$ integer each $$$x_{i}$$$, $$$y_{i}$$$, $$$r_{i}$$$.$$$(1 \le n \le 100)$$$$$$(1 \le x_{i}, y_{i}, r_{i} \le 10^5).$$$

Examples

Input
2
1 1 5
10 10 5
Output
1
Input
5
1 2 3
2 3 1
3 4 2
4 5 3
5 6 4
Output
5
Input
7
92387 35422 4898
32532 92988 4636
99872 57831 1700
47597 79017 5316
96560 4822 1820
62125 8873 1377
38988 12468 1596
Output
1

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.