PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000065. Xe buýt sân bay (Airport Bus)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Xe buýt sân bay (Airport Bus)
Airport Bus
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
There are passengers arriving at times . Each bus seats at most people. Passenger must depart on a bus at some time in the inclusive interval . Bus departure times may be arbitrary real numbers, and multiple buses may depart simultaneously. Minimize the number of buses.
Input
The first line contains . Each of the next lines contains one integer .
Output
Print the minimum number of buses.
Subtasks
- Subtask 1 (20 points): ; ; for every .
- Subtask 2 (30 points): ; ; for every .
- Subtask 3 (50 points): ; ; for every .
Examples
Input
5 3 5
1
2
3
6
12
Output
3
Explanation
The passengers arriving at can share one bus at time ; the arrivals at and need additional buses. Two buses are insufficient because arrivals at and are too far apart under the waiting limit. The answer is .