Problem K
Club Pizza
When Blaster first started at Mines, he joined as many different extracurricular clubs as he could. He loves getting involved on campus, and he also loves that many clubs provide free pizza! Unfortunately, now he is in too many clubs, and some of the meetings overlap. Additionally, if he eats too much pizza, then he will be too full to do any more activities.
Blaster still wants to attend as many clubs as he can. Each club meeting is only one hour long, but some club meetings might be at the same time as each other. Different clubs give different amounts of pizza, so he needs to decide which meetings to go to in order to maximize the amount of clubs he goes to before getting full of pizza.
If Blaster chooses optimally, how many clubs will he be able to attend?
Input
The first line of the input consists of two integers
The
Output
Output a single integer, the number of clubs that Blaster can attend.
Sample Input Explanations
In sample input 1, there are three clubs at 18:00, 19:00,
and 20:00 that give
In sample input 3, Blaster can either visit clubs
Sample Input 1 | Sample Output 1 |
---|---|
3 6 18 3 19 2 20 1 |
3 |
Sample Input 2 | Sample Output 2 |
---|---|
3 4 18 3 19 2 20 1 |
2 |
Sample Input 3 | Sample Output 3 |
---|---|
4 12 17 3 17 5 19 4 19 10 |
2 |