#C2192. Pair the Players
Pair the Players
Pair the Players
You are given an even number n representing the number of players and a list of n integer ratings. The task is to form n/2 pairs of players. First, sort the ratings in increasing order. Then, pair the players by taking two consecutive ratings in the sorted order. For each pair, compute the difference between the two ratings. Your goal is to find and output the minimum difference among all these pairs.
Note: All input and output operations should be performed using standard input (stdin) and standard output (stdout). It is guaranteed that n is even.
Example:
Input: 4 100 300 200 150</p>Sorted ratings: 100, 150, 200, 300 Pairs: (100,150) and (200,300) Differences: 50 and 100 Output: 50
inputFormat
The first line of input contains an even integer n representing the number of players. The second line contains n space-separated integers that represent the ratings of the players.
outputFormat
Output a single integer, which is the minimum difference between the ratings of players in any pair formed after sorting.
## sample4
100 300 200 150
50