P27157 [AtCoder] Table Tennis
普及
题目描述

Problem Description

Indeed Corporation has a table tennis table in their office.
$ n $ employees decided to play a doubles table tennis match.
They decided to form pairs of two, but they want everyone to enjoy the game as much as possible by making the strength of each pair as equal as possible.
The strength of the $ i $-th person in table tennis is represented by $ a_i $, and the strength of a pair is determined by the sum of the strengths of the two people.
When forming pairs to minimize the difference between the strongest pair and the weakest pair, what is that difference?

Input Format

The input is given in the following format:

$ n $ $ a_1 $ $ a_2 $ $ ... $ $ a_n $

  • The first line contains an integer $ n $ representing the number of employees ($4 \leq n \leq 100$, $ n $ is even).
  • The second line contains $ n $ integers $ a_i $ representing the strength of each employee in table tennis ($1 \leq a_i \leq 1{,}000$), separated by spaces.

Output Format

Output the desired value in one line.

Sample Input and Output

Sample Input #1

4
1 3 4 10

Sample Output #1

4

Sample Input #2

4
1 3 4 4

Sample Output #2

2

Notes/Hints

Sample Explanation 1

There are three possible team divisions: {$(1,3),\ (4,10)$}, {$(1,4),\ (3,10)$}, {$(1,10),\ (3,4)$}. Among these, the one with the smallest difference in pair strength is {$(1,10),\ (3,4)$}, and the difference is $ 4 $.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 1 3 4 10
样例输出
4