


The euclidian distance of a point [ x2, y2 ] from [ x1,y1 ] is given as

You need to round up your answer to the nearest three decimal places.
If the position of the customers is [ [ 1,0 ], [ 4,0 ], [ 6,0 ] ], then if Ninja opens his service center at [ 4,0 ] then he will get the minimum sum of euclidian distance = 5.000 from all customers.
The first line contains ‘T’ denoting the number of test cases.
The first line of each test case contains ‘N’ denoting the number of customers.
The next ‘N’ lines contain two space-separated integers ‘ x ’ and ‘ y ’ denoting the coordinates of the position of the customers.
For each test case, print a single integer denoting the minimum sum of Euclidian distance.
Print your answer up to the nearest three decimal places.
Print the output of each test case in a separated line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 10^3
0 <= location[ i ][ 0 ], location[ i ][ 1 ] <= 10^3
Where location[ i ][ 0 ], location[ i ][ 1 ] denotes the ‘ x ’ and ‘ y ’ coordinates of the position of customers.
Time Limit : 1 sec
We will use the concept of the geometric median to solve this problem.
If we are given ‘N’ points in the 2-D plane then a point ‘p’ whose sum of distances from all the points in the 2-D plane is minimum is known as the geometric median.
This is exactly the same that we have to do to solve the problem. The approach to find the geometric median is as -
Algorithm
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Points Visible
Points Visible
Points Visible
Circle Intersection
Circle Intersection
Circle Intersection
Circle Intersection
City Lights
Angler's Race