cswork / OA打开练习工作台

Goldman SachsOA #17

Process Scheduler

估计中等可在线判题

考点(AI 标注)前缀和区间单调栈与堆

Each process runs at every integer time from start to end, with both endpoints included. Find the maximum number of processes running at the same moment, which is the minimum number of cores required.

输入格式

The first line contains n (1..100000), followed by n lines, each with start[i] end[i], satisfying 1≤start≤end≤10^9.

输出格式

Output the minimum number of cores required.

样例 1

输入:

3
1 3
2 4
4 4

输出:

2

样例 2

输入:

1
1 1

输出:

1

样例 3

输入:

3
1 10
2 3
4 5

输出:

2