(CodeForces - 416C)Booking System
time limit per test:1 second
memory limit per test:256 megabytes
input:standard input
output:standard output
Innovation technologies are on a victorious march around the planet. They integrate into all spheres of human activity!
A restaurant called “Dijkstra’s Place” has started thinking about optimizing the booking system.
There are n booking requests received by now. Each request is characterized by two numbers: ci and pi — the size of the group of visitors who will come via this request and the total sum of money they will spend in the restaurant, correspondingly.
We know that for each request, all ci people want to sit at the same table and are going to spend the whole evening in the restaurant, from the opening moment at 18:00 to the closing moment.
Unfortunately, there only are k tables in the restaurant. For each table, we know ri — the maximum number of people who can sit at it. A table can have only people from the same group sitting at it. If you cannot find a large enough table for the whole group, then all visitors leave and naturally, pay nothing.
Your task is: given the tables and the requests, decide which requests to ac