PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#FW0000030. Kích nổ tối đa (Detonate the Maximum Bombs)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Kích nổ tối đa (Detonate the Maximum Bombs)

Detonate the Maximum Bombs

Source: LeetCode

Version: Phuoc Hung OJ Extended

Problem Statement

Each bomb has a center and a radius. Detonating one bomb triggers all bombs in its circular range, and the effect propagates. Maximize the number of detonated bombs.

Input

Integer nn, then nn lines xi,yi,rix_i,y_i,r_i.

Output

Print the maximum number of bombs that can detonate.

Subtasks

  • Subtask 1 (40 points): n≤10n\le10; 1≤n≤1001\le n\le100, 1≤xi,yi,ri≤1051\le x_i,y_i,r_i\le10^5; coordinates and radii are integers.
  • Subtask 2 (60 points): 1≤n≤1001\le n\le100, 1≤xi,yi,ri≤1051\le x_i,y_i,r_i\le10^5; coordinates and radii are integers.

Examples

Input

2
2 1 3
6 1 4

Output

2

Explanation

The centers are distance 44 apart. Radius 33 of the first bomb cannot reach the second; radius 44 of the second reaches the first, causing both explosions.