PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000078. Các sinh vật cần điều hòa (Air Conditioned Minions)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Các sinh vật cần điều hòa (Air Conditioned Minions)
Air Conditioned Minions
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
There are minions. Minion tolerates any integer room temperature in the closed interval . All minions must be assigned to rooms, each of which has one common temperature suitable for every occupant. A room can hold any number of minions. Find the minimum number of rooms.
Input
The first line contains . Each of the next lines contains .
Output
Print the minimum number of rooms.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
4
18 22
20 24
23 28
26 30
Output
2
Explanation
Place the first two minions in a room at temperature , and the last two at temperature . One room cannot work because intervals and have no common temperature. The minimum is .