#Q1. 「一本通 1.1 例 1」活动安排
「一本通 1.1 例 1」活动安排
Description
Given a set of activities , where each activity requires the use of a common resource, such as a lecture hall, and only one activity can use the resource at any given time. Each activity has a start time and an end time for using the resource, with . If activity is selected, it occupies the resource during the time interval . The intervals and are said to be compatible if they do not overlap, i.e., when or . The task is to select the largest subset of mutually compatible activities.
Input Format
The first line contains an integer ;
The next lines each contain two integers and .
Output Format
Output the maximum number of mutually compatible activities.
Sample 1
4
1 3
4 6
2 5
1 7
2
Constraints & Hints