A-2 The Best Grouping Balance
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
During the laboratary session, the teacher grouped all the students into pairs so they could help each other on their homework. The students' individual abilities are different, and the group ability is defined to be the sum of the ability values of the two students in that group. Now the teacher would like to have a grouping scheme that has the bestgrouping balance , that is, the difference between the maximum and minimum of all the group ability values is minimized.
Given the ability values of all the students, your job is to find this minimum difference.
输入格式
Each input file contains one test case. For each case, the first line gives a positive even number ( ), which is the number of students. The next line gives numbers, representing the students' individual abilities (each an integer in the interval ). All the numbers in a line are separated by spaces.
输出格式
For each test case, output in a line the minimum of the difference between the maximum and minimum of all the group ability values, over all the possible grouping schemes.
题目示例数据
10
996 385 402 763 102 88 571 29 816 663
183