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

17799번 - Feeding Seals 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB2191239961.491%

문제

You are in charge of feeding the seals in the Welsh Mountain Zoo. This involves purchasing buckets of fish and allocating them to volunteers to trek into the enclosure and distribute fairly to the blubbery residents.

The buckets of fish are already set out. Each volunteer can be assigned to carry either one or two of these buckets, as long as the combined weight of the buckets is small enough.

How many volunteers will you need to distribute all of the fish in one trip?

입력

  • The first line contains the number of buckets to be delivered, n (1 ≤ n ≤ 105), and the integer carrying capacity of a volunteer, c (1 ≤ c ≤ 109).
  • The second line contains the integer weights of each of the n buckets, w1 . . . wn (1 ≤ w ≤ c).

출력

Output the minimum number of volunteers required to deliver all of the buckets of fish.

제한

예제 입력 1

4 100
44 35 66 67

예제 출력 1

3

예제 입력 2

1 10
7

예제 출력 2

1

예제 입력 3

3 12
10 5 6

예제 출력 3

2

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2019 F번

  • 문제를 만든 사람: Ian Pratt-Hartmann
(追記) (追記ここまで)

출처

대학교 대회

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

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