#K35082. Largest Distance Among Points

    ID: 25452 Type: Default 1000ms 256MiB

Largest Distance Among Points

Largest Distance Among Points

Given several test cases, each containing a set of points in a 2D plane, your task is to calculate the largest Euclidean distance between any two points in each test case.

The Euclidean distance between two points \( (x_1, y_1) \) and \( (x_2, y_2) \) is defined as:

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

For each test case, output the computed largest distance formatted to 6 decimal places.

inputFormat

The input is given via standard input (stdin) with the following format:

  • The first line contains an integer \( T \), representing the number of test cases.
  • Each of the following \( T \) lines describes a single test case. Each test case starts with an integer \( N \), denoting the number of points, followed by \( 2N \) integers representing the x and y coordinates of each point.

For example:

2
3 0 0 0 1 1 0
2 -1 -1 1 1

outputFormat

For each test case, output one line containing the largest distance among all pairs of points in that test case, formatted to 6 decimal places. The output is sent to standard output (stdout).

For example:

1.414214
2.828427
## sample
2
3 0 0 0 1 1 0
2 -1 -1 1 1
1.414214

2.828427

</p>