Wifi Routers
Practice
3.7 (3 votes)
Algorithms
Approved
Graphs
Hard
Open
Shortest path algorithm
Problem
21% Success 1087 Attempts 50 Points 5s Time Limit 256MB Memory 1024 KB Max Code

IIIT Hyderabad is planning to install Wifi Routers in the campus to make it fully Wifi-enabled. Now each Wifi Router can only transmit data to a user or another WiFi Router only if the distance between Router and the receiving user/router is not more than R. Each Wifi Router has the same range R. A Wifi Router can get data from ground network or another Wifi Router. The aim here is that all the users get the data.

You have to find the minimal value of R that will ensure that all users get the data even if only one WiFi router is connected with ground network.

Input:

First line contains T, the number of testcase.

For each testcase: First line contains N, the number of WiFi Routers and M, the number of users.

Each of the next N lines contain (x,y) denoting the coordinates of the WifiRouters in the 2D plane. Next M lines denote the coordinates of the users.

Output:

Print the distance R rounded off to 6 decimal digits.

Constraints:

1 <= T <= 10

1 <= N,M <= 100

0 <= x,y <= 100

No two routers/users occupy the same place.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
2 votes
Tags:
ApprovedEasyGraphsReady
Points:50
2 votes
Tags:
AlgorithmsDepth First SearchDijkstra's algorithmGraphsHard
Points:50
8 votes
Tags:
Shortest Path AlgorithmsAlgorithmsGraphs