Logo
(追記) (追記ここまで)

19343번 - Bin Packing 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 256 MB149402431.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.

제한

예제 입력 1

4 10
5 6 3 7

예제 출력 1

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.

출처

Camp > Petrozavodsk Programming Camp > Winter 2018 > Day 9: Carnegie Mellon U Contest H번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /