Account
GitHubFeedback
Drafts and results saved on this device
Submit on CSES.fi
CSES Problemset/Sorting and Searching

Restaurant Customers

#1619
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

Time limit:1.00 s
Memory limit:512 MB
Unsolved
Download Tests (.zip)

You are given the arrival and leaving times of nn 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 nn: the number of customers.

After this, there are nn lines that describe the customers. Each line has two integers aa and bb: 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≤n≤2⋅1051 \le n \le 2 \cdot 10^5
  • 1≤a<b≤1091 \le a < b \le 10^9
Sample Test Cases (1)
Example 1ID: sample-1
Input
3
5 8
2 4
3 9
Expected Output
2
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 chars
Test Bench
Download .zip
Input (stdin)
3
5 8
2 4
3 9
Expected Output
2