Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Loan Scheduling
Description The North Pole Beach Bank has to decide upon a set App of mortgage applications. Each application t, 0≤_{a}t≤_{a}d. If the application is accepted the Bank gets a profit _{a}p. Time is measured in integral units starting from the conventional time origin 0, when the Bank decides upon all the _{a}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 S⊆App of applications that maximizes the profit . The problem is to compute the maximum profit the Bank can get from the given set App of mortgage applications.For example, consider that (p, _{b},d_{b})=(1,0)(p, and _{c},d_{c})=(2,0)(p. The table below shows all possible sets of accepted mortgage applications and the scheduling of the loan payments. The highest profit is _{d},d_{d})=(3,1)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.
Input 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: d, _{i}i=1..N, that specify the profit 0≤p and the deadline _{i}≤100000≤d of the application _{i}≤10000i. Input data are separated by white spaces, are correct, and terminate with an end of file.Output 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. Sample Input 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 Sample Output 9 2050 0 0 Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator