IBMOA #32
Get Minimum Cores
Estimated MediumJudge-ready
Topics (AI-labelled)Prefix & RangesStacks & Heaps
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.
Input
The first line contains n, followed by n lines of start end. 1≤n≤100000, 1≤start≤end≤10^9.
Output
Output one integer, the answer.
Example 1
Input:
3
1 3
3 5
4 6
Output:
2
Example 2
Input:
2
1 1
1 1
Output:
2
Example 3
Input:
2
1 2
3 4
Output:
1
Example notes
The examples give 2, 2 and 1 respectively; intervals that only touch at an end point still overlap.
Editorial
Loading solution…