#K40672. Checkpoint Distance Analysis

    ID: 26695 Type: Default 1000ms 256MiB

Checkpoint Distance Analysis

Checkpoint Distance Analysis

You are given a set of checkpoints placed on a circular track. Although the radius R of the circle is provided, the actual positions of the checkpoints are given by their Cartesian coordinates. Your task is to compute the minimum and the maximum Euclidean distances between any two distinct checkpoints.

The Euclidean distance between two points \((x_1, y_1)\) and \((x_2, y_2)\) is given by the formula:

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

You need to read the input from stdin and output the result on stdout.

inputFormat

The input begins with a line containing two numbers:

  • An integer or float R representing the radius of the circle (this value is not used in the distance calculations).
  • An integer N representing the number of checkpoints.

This is followed by N lines, each containing two space-separated numbers which represent the x and y coordinates of a checkpoint.

Example:

5 3
5 0
0 5
-5 0

outputFormat

Output two space-separated floating point numbers on one line: the minimum distance and the maximum distance between any pair of checkpoints.

Example:

7.0710678118654755 10.0
## sample
5 3
5 0
0 5
-5 0
7.0710678118654755 10.0