Bouquet of Balloons

시간 제한2초메모리 제한2048 MB

요약
푼 문제마다 받는 풍선의 양력 합이 어느 순간이라도 주사위 무게 m 이상이 되는 최소 문제 수를 구한다.
난이도

보통10점 중 6점

유형
그리디, 정렬
정답자
아직 제출이 없습니다

문제

On their journey to World Finals, Team Shuchiin Academy needs to first conquer the North America Championship. They have nn problems in the problemset, with problem ii taking s_is\_i minutes to solve. Team Shuchiin Academy can solve problems in any order but cannot work on problems in parallel. This means they must solve the problem they are currently working on before moving onto solving another problem. For each problem solved, the judges instantly bring a fully-inflated balloon to the team.

Chika Fujiwara, the troll of the team, decides to tie all of the balloons to the team's lucky dice so that it floats. Each balloon starts at 11 liter of helium at the time the team receives it, allowing it to lift 11 gram. All balloons have lifetime dd. Balloons deflate at a constant rate of 1d\frac{1}{d} liters per minute, with lifting capacity in grams decreasing at the same rate; for example, a balloon after d3\frac{d}{3} minutes can lift 23\frac{2}{3} grams, and stopping at 00 grams after dd minutes. The dice floats if, at any time, the sum of the lifting capacities of all the team's balloons is greater than or equal to the dice's mass mm. The mass of the balloon itself is negligible.

Given a problemset of nn problems with the time to solve the ithi^\text{th} problem as s_is\_i, along with deflation rate dd and dice mass mm, output the minimum number of problems Team Shuchiin Academy needs to solve to float the dice! If the dice cannot be floated, output −1-1.

입력

The first line of input contains three integers nn, dd, and mm (1≤n,d,m≤1051 \le n, d, m \le 10^5): the length of the problemset, the balloons' lifespan, and the mass of the dice.

The second line of input contains nn integers: problem solve times s_1s\_1 through s_ns\_n (1≤s_i≤1051 \le s\_i \le 10^5).

출력

Output a single integer: the minimum number of problems Team Shuchiin Academy needs to solve to float the dice, or −1-1 if impossible.

예제5

  1. 예제 1

    입력
    3 4 2
    1 5 2
    
    예상 출력
    3
    
  2. 예제 2

    입력
    4 5 2
    1 2 4 6
    
    예상 출력
    3
    
  3. 예제 3

    입력
    5 14 3
    1 2 4 6 8
    
    예상 출력
    4
    
  4. 예제 4

    입력
    5 12 3
    2 2 3 3 4
    
    예상 출력
    5
    
  5. 예제 5

    입력
    5 10 3
    2 2 3 3 4
    
    예상 출력
    -1