CSES - Restaurant Customers

View as PDF



Authors:
Problem types
Points: 1300 Time limit: 1.0s Memory limit: 512M Input: stdin Output: stdout

You are given the arrival and leaving times of \(n\) customers in a restaurant.

What was the maximum number of customers in the restaurant at any time?

Input

  • The first input line has an integer \(n:\) the number of customers.
  • After this, there are \(n\) lines that describe the customers. Each line has two integers \(a\) and \(b:\) the arrival and leaving times of a customer.
  • You may assume that all arrival and leaving times are distinct.

Output

  • Print one integer: the maximum number of customers.

Constraints

  • \(1 \leq n \leq 2 \cdot 10^5\)
  • \(1 \leq a < b \leq 10^9\)

Example

Sample input

3  
5 8  
2 4  
3 9

Sample output

2


Comments (5)

Most recent
Loading comments...