atcoder#ARC121A. [ARC121A] 2nd Greatest Distance
[ARC121A] 2nd Greatest Distance
Score : points
Problem Statement
There are houses numbered through on a two-dimensional plane. House is at .
We use Chebyshev distance to calculate the distance between two houses. That is, the distance between Houses and is .
There are pairs formed by two different houses. For each of these pairs, we will calculate the distance between the houses, and then we will sort these distances in descending order to get a sequence of length . Find the second value from the beginning of this sequence.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the second value from the beginning of the sequence of distances of different houses sorted in descending order.
3
0 0
1 2
4 0
3
- The distance between Houses and is ;
- The distance between Houses and is ;
- The distance between Houses and is .
- By sorting these in descending order, we get , where the second value from the beginning is .
4
0 0
0 0
1 0
0 1
1
- There may be multiple houses at the same coordinates.
20
407 361
167 433
756 388
-551 -47
306 -471
36 928
338 -355
911 852
288 70
-961 -769
-668 -386
-690 -378
182 -609
-677 401
-458 -112
184 -131
-243 888
-163 471
-11 997
119 544
1766