Bin Packing

아직 제출이 없습니다시간 제한4초메모리 제한256 MB

문제

You're given a collection of nn objects of weights w_1,w_2,,w_nw\_1, w\_2, \ldots, w\_n. You have to pack all nn objects into the minimum number of bins under the constraint that the total weight of all the objects in any bin is bounded by SS.

입력

The first line contains a pair of integers nn and SS, where 1n241 \leq n \leq 24 and 1S1081 \leq S \leq 10^8.  The second line contains w_1,w_2,,w_nw\_1, w\_2, \ldots, w\_n, where 1w_iS1 \leq w\_i \leq S.

출력

The output is just the minimum number of bins required to pack the given objects.

힌트

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.