一道acm题,Problem H:Groups (I)Time Limit:1000MS Memory Limit:65536KTotal Submit:93 Accepted:31 Description There are n people in the class and person pi has his value vi.Now,we'd like to put them into different groups.In each group,there must
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/17 15:45:36
![一道acm题,Problem H:Groups (I)Time Limit:1000MS Memory Limit:65536KTotal Submit:93 Accepted:31 Description There are n people in the class and person pi has his value vi.Now,we'd like to put them into different groups.In each group,there must](/uploads/image/z/11630696-32-6.jpg?t=%E4%B8%80%E9%81%93acm%E9%A2%98%2CProblem+H%3AGroups+%28I%29Time+Limit%3A1000MS+Memory+Limit%3A65536KTotal+Submit%3A93+Accepted%3A31+Description%E3%80%80%E3%80%80There+are+n+people+in+the+class+and+person+pi+has+his+value+vi.Now%2Cwe%27d+like+to+put+them+into+different+groups.In+each+group%2Cthere+must)
一道acm题,Problem H:Groups (I)Time Limit:1000MS Memory Limit:65536KTotal Submit:93 Accepted:31 Description There are n people in the class and person pi has his value vi.Now,we'd like to put them into different groups.In each group,there must
一道acm题,
Problem H:Groups (I)
Time Limit:1000MS Memory Limit:65536K
Total Submit:93 Accepted:31
Description
There are n people in the class and
person pi has his value vi.Now,we'd like to put them into different groups.In
each group,there must be two people,and the value of this group is equal to
the minimum of two member's values.For example,if pi and pj are in the same
group,the value of their group is min(pi,pj).Now,your task is to tell the
maximum and minimum of the sum of all groups.
Input
There are several test cases.
In
each case,there is an even integer n(n
一道acm题,Problem H:Groups (I)Time Limit:1000MS Memory Limit:65536KTotal Submit:93 Accepted:31 Description There are n people in the class and person pi has his value vi.Now,we'd like to put them into different groups.In each group,there must
个人感觉,可以先排序.那么最大的情况就是相邻两个组成一个pair,最小的情况就是首尾组成一个pair.例如,input:1 2 3 4 5 6 7 8 9 10.最大的情况就是(1 2)(3 4)(5 6)(7 8)(9 10),最小的情况就是(1 10)(2 9)(3 8)(4 7)(5 6).当然,最小的情况还有很多种排法,只要保证是最小的5个数输出就行,例如(1 6)(2 7)(3 8)(4 9)(5 10)也是可以的