#C1965. Taco Table Booking
Taco Table Booking
Taco Table Booking
You are given n tables, each with a maximum capacity m. Initially, each table has a certain number of guests seated. There are k booking requests. For each booking request, you must seat the party at a table that currently has the least number of guests (i.e. the smallest occupancy) such that the addition of the new guests does not exceed the table's maximum capacity.
The capacity constraint can be expressed mathematically as: $$ current\_guests + new\_group \leq m $$.
If multiple tables satisfy the condition, always choose the table with the smallest occupancy. If no table can accommodate the request, the booking is rejected. Your task is to determine the total number of accepted and rejected bookings.
inputFormat
The input is given via standard input (stdin) and consists of three lines:
- The first line contains three space-separated integers: n (the number of tables), m (the maximum capacity per table), and k (the number of booking requests).
- The second line contains n space-separated integers, where the i-th integer represents the current number of guests at the i-th table.
- The third line contains k space-separated integers; each integer denotes the number of guests for a booking request.
outputFormat
Output two space-separated integers on one line via standard output (stdout): the first integer is the number of accepted bookings, and the second integer is the number of rejected bookings.
## sample5 4 6
2 0 1 3 2
2 1 3 1 4 2
4 2