#P15836. [蓝桥杯第一届国际赛] 捕鱼达人

[蓝桥杯第一届国际赛] 捕鱼达人

Problem Description

Xiaoming is playing a fishing game on a plane. There are nn fish on the plane, and the coordinates of the ii-th fish are (xi,yi)(x_i, y_i).

At each moment, Xiaoming may choose one fish that is still on the plane and cast a net at its position. That fish will be caught in the net, and at the same time, all fish whose (Euclidean) distance to that fish is no more than RR will also be caught in the net. The caught fish are taken away by Xiaoming and disappear from the plane. Note that Xiaoming can only choose a fish that is still on the plane (not yet taken away) to cast the net. If there are no fish, he cannot cast the net.

Xiaoming wants to know the minimum number of net casts needed to catch all fish.

Hint: The Euclidean distance between two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) is defined as (x1−x2)2+(y1−y2)2\sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2}.

Input Format

The first line contains two integers n,Rn, R, representing the number of fish and the catching distance of the net.

The next nn lines each contain two integers, representing the coordinates of a fish.

Output Format

Output one line containing one integer, representing the minimum number of net casts.

3 4
0 0
2 3
-5 -3
2

Hint

Constraints

For 20%20\% of the testdata, 1≤n≤81 \le n \le 8.

For 40%40\% of the testdata, 1≤n≤121 \le n \le 12.

For 60%60\% of the testdata, 1≤n≤251 \le n \le 25.

For the remaining 40%40\% of the testdata, 1≤n≤501 \le n \le 50. The fish positions are generated using a random function and are uniformly distributed on the plane.

For all testdata, ∣xi∣,∣yi∣≤1000|x_i|, |y_i| \le 1000, and R≤2000R \le 2000.

Translated by ChatGPT 5