#P2377. Medication collection

Medication collection

题目描述

Tatsuta is a gifted child whose dream is to become the greatest doctor in the world. To this end, he wanted to take the most prestigious doctor in the neighborhood as a teacher. In order to judge his qualifications, the doctor gave him a problem. The doctor took him to a cave full of herbs and said to him, "Child, there are some different herbs in this cave, and it takes some time to pick each one, and each plant has its own value." I'll give you a while during which you can pick some herbs. If you are a smart child, you should be able to maximize the total value of the herbs you collect. ”

If you are Tatsuta, can you complete this task?

输入格式

输出格式

Output the maximum total value of herbs that can be harvested within a specified period of time.

样例

70 3 
71 100 
69 1 
1 2
3

提示

This question is the English version of the last question in Luogu, if you feel that the data is not enough, you can do it

By TOP