当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3541: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)
输出解释
Print the minimal M in one line.
输入样例
7 2
1
5
3
2
4
7
9
输出样例
2
来自杭电HDUOJ的附加信息
Recommend zhengfeng

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3541

最后修改于 2020-10-25T23:04:34+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
8000/4000MS(Java/Others) 131072/65536K(Java/Others)