cswork / OA打开练习工作台

IBMOA #32

Get Minimum Cores

估计中等可在线判题

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

Each process runs during the closed interval [start,end], and a core can run at most one process at a time. Find the minimum number of cores.

输入格式

The first line contains n, followed by n lines of start end. 1≤n≤100000, 1≤start≤end≤10^9.

输出格式

Output one integer, the answer.

样例 1

输入:

3
1 3
3 5
4 6

输出:

2

样例 2

输入:

2
1 1
1 1

输出:

2

样例 3

输入:

2
1 2
3 4

输出:

1

样例说明

The examples give 2, 2 and 1 respectively; intervals that only touch at an end point still overlap.