PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CC0000073. Khách trong nhà hàng (Restaurant Customers)
HỌC THEO LỘ TRÌNH
2 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Khách trong nhà hàng (Restaurant Customers)
Restaurant Customers
Source: CSES
Version: Phuoc Hung OJ Extended
Problem Statement
A restaurant records the arrival time and departure time of each customer. Find the largest number of customers present at any time. All arrival and departure times are distinct.
Input
The first line contains , followed by lines each containing .
Output
Print the maximum number of concurrent customers.
Subtasks
- Subtask 1 (20 points): ; ; all time values are distinct.
- Subtask 2 (30 points): ; ; all time values are distinct.
- Subtask 3 (50 points): ; ; all time values are distinct.
Examples
Input
3
5 8
2 4
3 9
Output
2
Explanation
The second customer stays from time to ; the third stays from to . Between and , two customers are present, which is the maximum.