#P469. 【例85.2】 区间调度问题
【例85.2】 区间调度问题
Description
The school has activities scheduled in the coming days, all of which require the use of the school's auditorium. At any given time, the auditorium can only be used by one activity. Due to time conflicts between some activities, the school office staff has to let some activities use other classrooms instead of the auditorium.
Given the start time and end time () for each of the activities, help the office staff arrange as many activities as possible to use the auditorium.
Input Format
The first line contains an integer ().
The next lines each contain two integers: the first is and the second is ().
Output Format
Output the maximum number of activities that can be arranged.
Sample
11
3 5
1 4
12 14
8 12
0 6
8 11
6 10
5 7
3 8
5 9
2 134