← 返回 google 的题目列表Taxi Dispatch (Wrapper around Meeting Rooms II)
类型:online_judge
Problem: Taxi Dispatch (Wrapper around Meeting Rooms II)
You are given a list of ride requests. Each request is a time interval [start, end) where start is the pickup time, end is the drop-off time, and end > start. A taxi can serve at most one request at any time.
Return the minimum number of taxis needed to serve all requests.
Input (stdin)
Line 1: integer n, the number of requests.
Next n lines: two integers start end representing an interval [start, end).
Output (stdout)
One integer: the minimum number of taxis required.
Constraints
1 <= n <= 2 * 10^5
0 <= start < end <= 10^9
Example
Input:
3
0 30
5 10
15 20
Output:
2
Example
Input
3
0 30
5 10
15 20
Output
2