The Team of ACM/ICPC

问题描述 :

There are 3 people in a team of ACM/ICPC. Every member of the team will occasionally make some mistakes in the contest. So Mr.F tests every one and everybody gets a Mistake Value x. If the Mistake Values of the 3 members of a team are respectively a, b, c, then the Mistake Value of the team is m = min{ |a-b|, |b-c|, |c-a| }.
Your job is to find the best plan to minimize M which is the sum of all the Mistake Value of teams.
输入:

In the first line, there are two integers N and K. N is the number of people who will make teams and K is the number of teams which is supposed to make. (3<= N <=100000) (0<= k <= N/3 )
There are N lines followed. Each line has an integer D, which is the Mistake Value of the person.(0<=D<=1000000000)
输出:

In the first line, there are two integers N and K. N is the number of people who will make teams and K is the number of teams which is supposed to make. (3<= N <=100000) (0<= k <= N/3 )
There are N lines followed. Each line has an integer D, which is the Mistake Value of the person.(0<=D<=1000000000)
样例输入:

7 2
1
5
3
2
4
7
9
样例输出:

2

http://www.acmerblog.com/hdu-3541-the-team-of-acmicpc-6502.html

https://www.baidu.com/link?url=8F8IU5EZpE1YYopmj0s2hm5SLu5IVDk_iNDkN-CcODD-yV1Uyrd5D1O9obFp3-Mcg7ZOGtoC2RvLm7ZA44uSrQggi_7JTgexOxXKREtoypW&wd=&eqid=9914cfc9000b67980000000458b8b48c