PivotOJ

Feeding Seals

시간 제한: 2000ms메모리 제한: 512MB출처: UKIEPC 2019BOJ 17799

문제

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
출력
3

예제 2

입력
1 10
7
출력
1

예제 3

입력
3 12
10 5 6
출력
2
코드를 제출하려면 로그인하세요.