#P6900. Wireless Sensor Network Clique

    ID: 20107 Type: Default 1000ms 256MiB

Wireless Sensor Network Clique

Wireless Sensor Network Clique

A wireless sensor network consists of autonomous sensors scattered in an environment where they monitor conditions such as temperature, sound, and pressure. In the ACM project in the Amazon rainforest, researchers need to select a subset of sensors with the property that every pair of sensors in the subset can communicate directly. Two sensors can communicate directly if and only if the Euclidean distance between them is at most \(d\). Given the fixed positions of the sensors, the goal is to choose as many sensors as possible such that the condition holds.

Task: Find the size of the largest subset of sensors such that every pair of sensors in the subset has a distance \(\le d\) from each other.

Note: Each sensor is represented as a point \((x, y)\) in the two-dimensional plane and the distance between any two points \((x_1,y_1)\) and \((x_2,y_2)\) is the usual Euclidean distance, given by:

[ \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2} ]

inputFormat

The first line contains two numbers: an integer \(n\) (the number of sensors) and a floating-point number \(d\) (the communication distance threshold).

Each of the following \(n\) lines contains two floating-point numbers, representing the coordinates \(x\) and \(y\) of a sensor.

outputFormat

Output a single integer, the maximum number of sensors that can form a subset where every pair of sensors can directly communicate (i.e. their Euclidean distance is at most \(d\)).

sample

1 10
0 0
1