PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#PS0000247. Màu sơn được ưa chuộng nhất (AtColor)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Màu sơn được ưa chuộng nhất (AtColor)
AtColor
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
AtColor must choose an integer shade between 0 and 1000000 for its gray paint. Customer among surveyed customers will buy it exactly when . Find the maximum possible number of buyers.
Input
First line: . Each of the next lines contains .
Output
Print the maximum number of buyers, not the shade.
Subtasks
- Subtask 1 (30 points): ; .
- Subtask 2 (70 points): ; .
Example 1
Input
4
0 2
2 3
2 4
5 6
Output
3
Explanation
Shade 2 belongs to the first three intervals; none belongs to all four.
Example 2
Input
4
1000000 1000000
1000000 1000000
0 1000000
1 1000000
Output
4
Explanation
All four customers accept shade 1000000.