eolymp
bolt
Try our new interface for solving problems
Məsələlər

Meeting Room Arrangement

Meeting Room Arrangement

Faculty of Engineering of PSU has a large meeting room for faculty staff to organize events and meetings. The use of the meeting room must be reserved in advance. Since the meeting room is available in \textbf{10} hours per day and there may be several events that want to use the meeting room, the best usage policy is to maximize the number of events in day. Suppose that the meeting room is available from time \textbf{0} to \textbf{10} (\textbf{10} hours). Given the list of start time and finish time of each candidate event, you are to write a program to select the events that fit in the meeting room (i.e. their times do not overlap) and give the maximum number of events in a day. \InputFile The first line is a positive integer \textbf{n} (\textbf{1} ≤ \textbf{n} ≤ \textbf{100}) which determines the number of days (test cases). Each test case consists of the time of the candidate events (less than \textbf{20} events). Each event time includes \textbf{2} integers which are start time(\textbf{s}) and finish time(\textbf{f}), \textbf{0} ≤ \textbf{s} ≤ \textbf{9}, \textbf{1} ≤ \textbf{f} ≤ \textbf{10} and \textbf{s} < \textbf{f}. The line containing \textbf{0 0} indicates the end of each test case. Note that an event must use at least \textbf{1} hour. \OutputFile For each test case, print out the maximum number of events that can be arranged in the meeting room.
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 128 MiB
Giriş verilənləri #1
3
0 6
5 7
8 9
5 9
1 2
3 4
0 5
0 0
6 10
5 6
0 3
0 5
3 5
4 5
0 0
1 5
3 9
0 0
Çıxış verilənləri #1
4
4
1
Müəllif Amarin Deemagarn
Mənbə ACM-ICPC Asia Phuket Regional Programming Contest 2013, 22 November 2013