← 返回 amazon 的题目列表Minimum Machines for All Tasks
类型:online_judge
Given n task time intervals, each machine can run at most one task at a time. Compute the minimum number of machines required to schedule all tasks.
Each task interval is [start, end], where start < end. If one task ends at time t and another starts at time t, they may use the same machine.
Input Format
First line: integer n
Next n lines: two integers, start end
Output Format
Print the minimum number of machines needed.
Example
Input:
3
0 30
5 10
15 20
Output:
2
Constraints
0 <= n <= 2 * 10^5
-10^9 <= start < end <= 10^9
Example
Input
3
0 30
5 10
15 20
Output
2