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

21135번 - Bad Packing 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
6 초 512 MB134454139.806%

문제

We have a knapsack of integral capacity and some objects of assorted integral sizes. We attempt to fill the knapsack up, but unfortunately, we are really bad at it, so we end up wasting a lot of space that can’t be further filled by any of the remaining objects. In fact, we are optimally bad at this! How bad can we possibly be?

Figure out the least capacity we can use where we cannot place any of the remaining objects in the knapsack. For example, suppose we have 3ドル$ objects with weights 3ドル,ドル 5ドル$ and 3ドル,ドル and our knapsack has capacity 6ドル$. If we foolishly pack the object with weight 5ドル$ first, we cannot place either of the other two objects in the knapsack. That’s the worst we can do, so 5ドル$ is the answer.

입력

The first line of input contains two integers $n$ (1ドル \le n \le 1,000$) and $c$ (1ドル \le c \le 10^5$), where $n$ is the number of objects we want to pack and $c$ is the capacity of the knapsack.

Each of the next $n$ lines contains a single integer $w$ (1ドル \le w \le c$). These are the weights of the objects.

출력

Output a single integer, which is the least capacity we can use where we cannot place any of the remaining objects in the knapsack.

제한

예제 입력 1

3 6
3
5
3

예제 출력 1

5

힌트

출처

ICPC > Regionals > North America > Southeast USA Regional > 2020 Southeast USA Regional Programming Contest B번

ICPC > Regionals > North America > Mid-Central Regional > 2020 Mid-Central Regional Programming Contest J번

ICPC > Regionals > North America > Pacific Northwest Regional > 2020 ICPC Pacific Northwest Region > Division 1 M번

ICPC > Regionals > North America > Pacific Northwest Regional > 2020 ICPC Pacific Northwest Region > Division 2 AD번

ICPC > Regionals > North America > Mid-Atlantic Regional > 2020 Mid-Atlantic USA Regional Contest F번

ICPC > Regionals > North America > South Central USA Regional > 2020 South Central USA Regional Contest B번

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

출처

대학교 대회

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

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