#P2095. 营养膳食
营养膳食
Description
Mr. L is working on his weight gain plan.
To gain weight, Mr. L wants to eat more fat. However, he cannot eat only high-fat foods, otherwise he would lack other nutrients.
Through research, Mr. L found that a truly balanced diet sets an upper limit on the number of servings of each category in a single meal. For example, for one meal: at most serving of meat, at most serving of fish, at most serving of eggs, and at most servings of vegetables.
Mr. L wants to maximize fat intake while following a nutritional diet, and of course his capacity is limited.
Input Format
The first line contains three positive integers , and . Here, is the maximum number of servings Mr. L can eat in one meal; there are foods to choose from, and these foods fall into categories.
The second line contains positive integers, each not exceeding , where the -th number gives the maximum number of servings allowed for category in a single meal, for categories through .
Each of the next lines contains positive integers: the fat index of that food and its category .
Output Format
Output a single integer: the maximum possible total fat index that Mr. L can eat.
6 6 3
3 3 2
15 1
15 2
10 2
15 2
10 2
5 3
60
Hint
For of the testdata, , , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号