#P17016. [GESP202606 八级] 线网建设

[GESP202606 八级] 线网建设

Problem Description

City A has nn base stations that need to be connected to each other through a wire network. The ii-th base station is located at coordinates (xi,yi)(x_i, y_i) on a 2D plane.

The distance between the ii-th base station and the jj-th base station is defined as (xixj)2+(yiyj)2\sqrt{(x_i - x_j)^2 + (y_i - y_j)^2}.

If the distance between two base stations is no more than a given integer ll, then a line connecting these two base stations can be built, and the line length is the distance between the two stations.

If starting from one base station, you can reach another base station by traveling along a series of lines in the network, then these two base stations are considered connected to each other.

What is the minimum total length of lines that must be built so that all nn base stations are mutually connected? If it is impossible to build a network that satisfies the condition, output Impossible.

Input Format

The first line contains two positive integers n,ln, l, representing the number of base stations and the upper limit on the line length.

The next nn lines each contain two integers xi,yix_i, y_i, representing the coordinates of a base station.

Output Format

Output one line. If a network satisfying the condition can be built, output the minimum total length of lines that need to be built, rounded to two decimal places. Otherwise output Impossible.

4 2
1 0
-1 -1
0 0
1 1
3.41
4 1
1 0
-1 -1
0 0
1 1
Impossible

Hint

Constraints

For 40%40\% of the testdata, it is guaranteed that 1n1001 \le n \le 100.

For all testdata, it is guaranteed that 1n5001 \le n \le 500, 1l1001 \le l \le 100, 100xi,yi100-100 \le x_i, y_i \le 100.

Translated by ChatGPT 5