| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 4 초 | 256 MB | 149 | 40 | 24 | 31.579% |
You're given a collection of $n$ objects of weights $w_1, w_2, \ldots, w_n$. You have to pack all $n$ objects into the minimum number of bins under the constraint that the total weight of all the objects in any bin is bounded by $S$.
The first line contains a pair of integers $n$ and $S,ドル where 1ドル \leq n \leq 24$ and 1ドル \leq S \leq 10^8$. The second line contains $w_1, w_2, \ldots, w_n,ドル where 1ドル \leq w_i \leq S$.
The output is just the minimum number of bins required to pack the given objects.
4 10 5 6 3 7
3
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 size is 21.