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

建议使用的浏览器:

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

2759:Distributing tasks

题目描述
One day, Jiajia and Wind went out to plant trees with their m-2 children. They believe that trees should be in couples, just like human beings, so they decided to plant an even number of trees, say, 2n trees, in two rows, with n trees in each row. Planting some trees are more difficult than planting some others, so Jiajia carefully measured the difficulty value of each tree and wants to divide the trees into m sets, one for each of the m people to work with.

Each of the m people should plant all the trees in a rectangular with sides parallel to the axis. The difficulty value of a person is the sum of difficulty values of all trees he plants. Since Jiajia should always take the heaviest job (no, he can't leave the most difficult task to his honey, Wind, or their lovely children), Jiajia would like to make his own life easier by minimizing the maximal difficulty value over all the m tasks.

The figure of sample input is below. Different colors represent different jobs. There are only 3 people (Jiajia, Wind and Autumn) in this sample, but your program should be able to handle more complex situations, in which Jiajia and Wind have a loooooot of chilren :)

输入解释
The first line of input contains two integers n and m, the following two lines contain n integers each, representing the difficulty values of each tree, from left to right. You may assume that n<10001, m<=min{2*n,1000}. The sum of all difficulty values would not exceed 230.
输出解释
The output should contain a single integer, the minimized difficulty value of Jiajia's task.
输入样例
3 3
1 2 6
2 1 6
输出样例
6

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2759

最后修改于 2020-10-29T06:42:09+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000 65536