#P10464. Task
Task
题目描述
Today the company has tasks to complete. The th task need minutes to complete. Meanwhile, this task has a difficulty level . The machine whose level below this task’s level cannot complete this task. If the company completes this task, they will get dollars.
The company has machines. Each machine has a maximum working time and a level. If the time for the task is more than the maximum working time of the machine, the machine can not complete this task. Each machine can only complete a task one day. Each task can only be completed by one machine.
The company hopes to maximize the number of the tasks which they can complete today. If there are multiple solutions, they hopes to make the money maximum.
输入格式
The input contains several test cases.
The first line contains two integers and . is the number of the machines.M is the number of tasks .
The following lines each contains two integers . is the maximum time the machine can work. is the level of the machine.
The following lines each contains two integers . is the time we need to complete the task. is the level of the task.
输出格式
For each test case, output two integers, the maximum number of the tasks which the company can complete today and the money they will get.
1 2
100 3
100 2
100 1
1 50004