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

建议使用的浏览器:

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

3483:Loan Scheduling

题目描述

The North Pole Beach Bank has to decide upon a set App of mortgage applications. Each application aApp has an acceptance deadline da, ie. the required loan must be paid at a time ta, 0≤tada. If the application is accepted the Bank gets a profit pa. Time is measured in integral units starting from the conventional time origin 0, when the Bank decides upon all the App applications. Moreover, the Bank can pay a maximum number of L loans at any given time. The Bank policy if focussed solely on profit: it accepts a subset SApp of applications that maximizes the profit __poj_jax_start__\textit{profit}(S)=\sum_{a\in S}p_a__poj_jax_end__. The problem is to compute the maximum profit the Bank can get from the given set App of mortgage applications.

For example, consider that L=1, App={a,b,c,d}, (pa,da)=(4,2), (pb,db)=(1,0), (pc,dc)=(2,0), and (pd,dd)=(3,1). The table below shows all possible sets of accepted mortgage applications and the scheduling of the loan payments. The highest profit is 9 and corresponds to the set {c,d,a}. The loan requested by the application c is paid at time 0, the loan corresponding to d is paid at time 1, and, finally, the loan of a is paid at time 2.

TimeSets of accepted applications and loan scheduling
0abcdbcbbccddabc
1adddaaadddd
2aaaaaaa
Profit4441233455566777789
输入解释

Write a program that reads sets of data from an input text file. Each data set corresponds to a set of mortgage applications and starts with two integers: 0≤N≤10000 that shows the number of applications in the set, and 0≤L≤100 which shows the maximum number of loans the Bank can pay at any given time. Follow N pairs of integers pi di, i=1..N, that specify the profit 0≤pi≤10000 and the deadline 0≤di≤10000 of the application i. Input data are separated by white spaces, are correct, and terminate with an end of file.

输出解释

For each data set the program computes the maximum profit the Bank can get from the accepted mortgage applications corresponding to that data set. The result is printed on standard output from the beginning of a line. There must be no empty lines on output. An example of input/output is shown below.

输入样例
4 1     4 2  1 0   2 0    3 1

7 2
200 1   200 1   100 0   1000 2    80 1
50 20   500 1

0 100

1 0     4 1000
输出样例
9
2050
0
0

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

源链接: POJ-3483

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

共提交 0

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