Bin Packing
Time limit4sMemory limit256 MB
Given up to 24 item weights and a bin capacity S, find the minimum number of bins that hold all items with each bin's total weight at most S.
- Level
Medium7 of 10
- Topics
- Dynamic programming, Bit manipulation, Backtracking, Greedy
- Solved
- No attempts yet
Problem
You are given objects of weights . Pack all objects into the minimum number of bins such that the total weight of the objects in any bin is at most .
Input
The first line contains two integers and , where and . The second line contains , where .
Output
Print the minimum number of bins required to pack the given objects.
Hint
The objects can be packed into three bins of size 10 as follows: [5,3], [6], [7]. It is impossible to pack them into two bins because their total weight is 21.