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

建议使用的浏览器:

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

3459:Projects

题目描述

In a certain week, a company wants to finish m projects. To this end, the company can employ at most n people from the unemployment agency for a period of one week. Each external employee will cost the company salary euro, unless the project in which he/she is involved is not completed in time. In that case no payment is due.

For each project the company knows from experience the probability that the project will be completed within a week, as a function of the number of employees working on it. These probabilities are given as percentages pij, where i (with 1 ≤ im) is the number of the project and j is the number of people working on it. Of course, when nobody is working on a project i, the probability pi0 is zero percent.

If project i is indeed finished within a week, the company earns reward(i) euro; if it is not ready in time, the company has to pay a fine of punishment(i) euro.

Of course the company wants to maximise its total expected profit1 at the end of the week by finding the optimal number of external employees to hire, and how to divide them over the projects. The optimal number of employees is the total number of people needed to achieve the maximal expected profit. Your task in this matter is to calculate this optimal number of external employees. Remember that at most n people are available. Furthermore: if a person is employed, he/she works on one and only one project.


1Let p (0 < p < 1) be the probability that a job is finished in time, and let E1 be the profit in that case. Furthermore, let E2 be the (negative) profit in case the job is not finished in time. Then the expected profit for this particular job is pE1 + (1 − p)⋅E2.

输入解释

The first line of the input file contains a single number: the number of test cases to follow. Each test case has the following format:

  • One line with one integer m with 1 ≤ m ≤ 100: the number of projects.
  • One line with one integer n with 0 ≤ n ≤ 100: the maximal number of available employees.
  • One line with one integer salary with 0 ≤ salary ≤ 1,000: the salary of one employee. Remember that the salary is given in euros.
  • m lines, each line corresponding to a project i, containing n integers pi1, pi2, …, pin (the percentages, with 0 ≤ pi1, pi2, …, pin ≤ 100), followed by two integers corresponding to the reward and the punishment for project i. All values are separated by single spaces. Both reward and punishment are given in euros and are between 0 and 100,000 (boundaries included).
输出解释

For every test case in the input file, the output should contain two lines.

  • The first line contains the maximal expected profit in eurocents.
  • The second line contains the total number of external employees that must be hired in order to achieve this maximal expected profit. If the maximal expected profit can be achieved by different (total) numbers of employees, then these different numbers must be given in increasing order. Numbers have to be separated by single spaces.
输入样例
3
1
4
200
90 100 100 100 2000 0
2
2
100
80 80 2100 500
0 100 1700 500
3
4
100
100 80 80 70 1000 100
100 90 80 90 500 50
100 70 60 50 700 100
输出样例
162000
1
100000
1 2
190000
3

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

源链接: POJ-3459

最后修改于 2020-10-29T07:02:08+00:00 由爬虫自动更新

共提交 0

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