#P3428. [POI 2005] AKC-Special Forces Manoeuvres

[POI 2005] AKC-Special Forces Manoeuvres

Description

A secret organization is conducting a military exercise in the desert. The goal is to defuse a bomb hidden in the desert.

The first phase is an airdrop operation. Each paratrooper jumps from a helicopter hovering over the desert in a fixed order. Upon landing, each paratrooper stays at his landing point.

Each paratrooper has a survival radius. If the bomb is at a distance less than or equal to this survival radius, the paratrooper will sacrifice himself to trigger the bomb. The commander wants to send as few paratroopers as possible, but he also wants at least one paratrooper to survive in the worst case.

The entire desert can be modeled as a plane. Each paratrooper’s landing point is a coordinate (x,y)(x, y), and we denote his survival radius by rr. All paratroopers’ information is given in the order they jump: when the ii-th paratrooper jumps, the first i1i-1 paratroopers have already landed.

Your task is to read all paratroopers’ information from standard input and output the minimum number of paratroopers that must be sent.

Input Format

The first line contains an integer nn (2n20002 \le n \le 2000).

The next nn lines: the ii-th line contains three integers xi,yi,rix_i, y_i, r_i (1000xi,yi1000-1000 \le x_i, y_i \le 1000, 1ri50001 \le r_i \le 5000), indicating that the ii-th paratrooper lands at (xi,yi)(x_i, y_i) with survival radius rir_i.

Output Format

If it is impossible to have at least one paratrooper survive, output NIE.

Otherwise, output a single integer: the minimum number of paratroopers that must be sent.

5
2 2 4
7 2 3
4 3 1
5 7 1
8 7 1
4

Hint

In the worst case, the bomb is at (5,3)(5, 3). The first three paratroopers die, and the fourth survives.

Translated by ChatGPT 5