영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)
Problem
A beetle finds itself on a thin horizontal branch. “Here I am on a thin horizontal branch”, thinks the beetle, “I feel pretty much like on an x-axis!”. It surely is a beetle of deep mathematical thought.
There are also n drops of dew on that same branch, each holding m units of water. Their beetle-based integer coordinates are x_1, x_2, …, x_n.
It is clear that the day will be hot. Already in one unit of time one unit of water goes away from each drop. The beetle is thirsty. It is so thirsty that if it reached a drop of dew it would drink it in zero time. In one unit of time the beetle can crawl one unit of length. But would all this crawling pay off? That's what buzzes the beetle.
So you are to write a program which, given coordinates of dew drops, calculates the maximal amount of water the beetle can possibly drink.
Input
The first line contains two integers n and m (1 ≤ n ≤ 300, 1 ≤ m ≤ 10^6).
The next n lines each contain one of the integer coordinates x_1, x_2, …, x_n (-10,000 ≤ x_i ≤ 10,000). Each x_i is distinct.
Output
Print an integer: the maximum amount of water the beetle can possibly drink.
Scoring
Your solution will be tested on a set of test groups. To earn points for a group, you must pass all test cases in that group.
| Group | Points | Constraints |
|---|---|---|
| 1 | 5 | x_i ≥ 0 |
| 2 | 10 | n ≤ 20, m ≤ 1000 |
| 3 | 35 | n ≤ 100, m ≤ 1000 |
| 4 | 30 | n ≤ 100 |
| 5 | 20 | No additional constraints. |
예제
예제 1
3 15 6 -3 1
25