PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BS0000276. Phân phối hàng hóa tối ưu (Minimized Maximum of Products Distributed to Any Store)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Phân phối hàng hóa tối ưu (Minimized Maximum of Products Distributed to Any Store)
Minimized Maximum of Products Distributed to Any Store
Source: LeetCode
Version: Phuoc Hung OJ Extended
Problem Statement
There are stores and product types, with items of type . Distribute all items; each store may receive at most one type and may remain empty. Minimize the largest number of items assigned to any store.
Input
First line: . Second line: integers .
Output
Print the optimal value.
Subtasks
- Subtask 1 (20 points): ; ().
- Subtask 2 (30 points): ; ().
- Subtask 3 (50 points): ; ().
Examples
Input 1
6 2
11 6
Output 1
3
Explanation
The first type uses loads 3,3,3,2 and the second uses 3,3. A cap of 2 requires nine stores, exceeding six.