JPMorgan ChaseOA #22
Task Scheduling
估计中等可在线判题
Each task occupies one machine during [start,end], endpoints included, and each machine runs at most one task at any moment. Find the minimum number of machines. Original example 2 contains an invalid task with start>end and its explanation re-pairs the values, so this corrupted example is not used.
输入格式
The first line contains n, followed by n lines of start end; full original bounds 1≤n≤200000, 1≤start≤end≤1000000000.
输出格式
Output a single integer answer.
样例 1
输入:
5
1 7
8 9
3 6
9 14
6 7
输出:
3
样例 2
输入:
4
2 5
2 5
2 5
2 5
输出:
4
样例 3
输入:
2
1 2
2 3
输出:
2
样例说明
The outputs of the three public examples are, in order: 3; 4; 2. These answers have been checked by independent enumeration or direct simulation.