PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BS0000345. Lập kế hoạch chuyến thám hiểm (Planning The Expedition)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Lập kế hoạch chuyến thám hiểm (Planning The Expedition)
Planning The Expedition
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
An expedition has n participants and m single-use daily food packages. Package i has type . Each participant consumes one package daily and must keep the same food type throughout. Different participants may share a type. Maximize the expedition duration.
Input
First line: . Second line: integers .
Output
Print the maximum number of days, or 0 if even one day is impossible.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; ; all packages have the same type.
- Subtask 3 (50 points): ; .
Examples
Input 1
4 10
1 5 2 1 1 1 2 5 7 2
Output 1
2
Explanation
Type 1 has four packages, type 2 three, type 5 two. Assign two people type 1 and one each types 2 and 5 for two days. Three days require at least twelve packages.
Input 2
3 2
1 1
Output 2
0
Explanation
There are not enough packages for one day.