Submit | All submissions | Best solutions | Back to list |
MEETINGS - Meetings |
At last you got lucky. You started working in a large reputable company. Someone appreciate your outstanding abilities and now you have an opportunity to show off. You can't wait for your first task.
You're following the manager who is leading you to the hallway full of doors. You got a piece of paper and all you heard from your new supervisor before he disappeared in one of the rooms: "Here's a list of scheduled meetings for the next week. Arrange them so that as many of them will take place."
Can you do that?
Input
At the begining there is d (0 < d ≤ 1000) denoting the number of days to develop. Every day is defined as follows: first the number of available rooms r (0 < r ≤ 105) and scheduled meetings m (0 < m < 106). Then m lines describing the meetings. Single meeting consists of four values: bh:bm, eh:em (0 ≤ bh, eh ≤ 23, 0 ≤ bm, em ≤ 59) which are time (in format: hours: minutes) of the begining and ending. No meeting begins and ends at the same time. The start time is always earlier than the end. Meetings take place within one day (no meetings begin one day and finish the next).
Size of the input files does not exceed 9M.
Output
For each day you have to specify the maximum number of meetings that can take place and assign meetings to rooms. In the next lines list meetings which will take place in each rooms.
- Meetings are numbered in order they appear on the entry. Meetings are numbered from 1 to m.
- Meetings can't overlap but could begin at the end of the previous one.
- If meetings can be allocated on the several ways write any of them (meetings assigned to the room can be given in any order). There is a custom judge to check correctness of Your output.
- Rooms are not numbered. If you can use 7 from 10 rooms just write 7 lines.
- Separate solution for each day by empty line (even the last one).
Example:
Input: 2
2 3
11:20 12:00
11:30 11:40
11:40 11:55
3 6
17:15 18:30
17:20 19:00
17:15 18:00
16:55 17:55
17:10 18:10
17:00 18:00
Output: 3
1
2 3
3
1
2
3
Added by: | Grzegorz SpryszyĆski |
Date: | 2015-10-17 |
Time limit: | 1s-2s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |