|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||0||0||0||0.000%|
You are the owner of a very nice boat. You have many requests to rent your beautiful boat during the summer time and you decided to maximize your profit. For each client you know the number of days he wants to rent the boat and a list of choices, where a choice means an amount of money and a deadline. The deadline is the number of days counted from a time origin. You get the money for a given deadline (when the holiday must end) only if you are able to rent the boat before that deadline.
For example your friend Jack wants to travel on the Mediterranean Sea for 20 days and has the following choices:
If a client does not contribute to the maximization of your profit you can drop that client. You know all the clients and their choices and you must rent the boat according to the order in which the clients submit their requests.
Write a program that, given the clients, computes the largest profit you can get.
The program input is from a text file. Each data set in the input has the following format:
An empty line separates the input data sets.
For each data set the program must print (from the beginning of a line) the maximum profit for that set. The results must be printed on the standard output. An empty line separates the results of different data sets. An example is given in the following table:
3 2 2 4 4 1 2 14 3 4 25 2 4 12 3 3 10