#P1843. Drying Clothes

    ID: 15126 Type: Default 1000ms 256MiB

Drying Clothes

Drying Clothes

Bear Mama has one clothes-drying machine and a set of clothes, each with a certain initial moisture level. Under natural conditions, a piece of clothing loses a units of moisture per second. In addition, if the clothes-drying machine is used on a clothing item for one second, it loses an extra b units of moisture during that second (so that it loses a total of a+b units in that second). Note that the machine can be used on at most one piece of clothing in any given second, while all clothes dry naturally at the same time.

You are given n pieces of clothing. The ith piece of clothing initially has a moisture level of w_i (all w_i are distinct). A piece of clothing is considered dry when its moisture level becomes 0 or less. Find the minimum number of seconds needed to completely dry all the clothes.

The process naturally dries every piece of clothing by a units per second. In addition, you can choose one piece of clothing per second to further reduce its moisture by b units. Formally, for a given time t (in seconds), the remaining moisture on the ith cloth will be max(w_i - a \times t, 0). To dry it completely using the machine, the number of additional seconds needed is:

$$\left\lceil \frac{\max(w_i - a \times t,0)}{b} \right\rceil.$$

You need to choose a schedule for using the machine such that the total extra machine seconds used across all clothes does not exceed t (since the machine can be used once per second). Find the minimum t for which this is possible.

inputFormat

The first line contains three integers n, a, and b — the number of clothes, the amount of moisture each cloth loses naturally per second, and the extra moisture lost when using the drying machine for one second, respectively.

The second line contains n distinct integers w1, w2, ..., wn, where wi is the initial moisture level of the ith piece of clothing.

outputFormat

Output a single integer — the minimum number of seconds required to dry all the clothes.

sample

1 2 3
10
4