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

27391번 - Platform Placing 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.5 초 (추가 시간 없음) 1024 MB23171386.667%

문제

The city of Atlantis is making an above-water section. They are doing so by building floating platforms that are anchored at their centers to foundation points that lie in a straight line at the bottom of the ocean. Each platform is a fixed-width rectangle aligned to the foundation line; specifically, a platform of length $\ell$ anchored to a foundation point at position $x$ along the line occupies the interval $[x - \frac{\ell}{2}, x + \frac{\ell}{2}]$ along the line on the ocean surface. The platforms can be of different lengths, but have both a minimum and a maximum length. Gaps are allowed between consecutive platforms, and platforms are allowed to exactly touch, but they may not overlap. Each foundation point must be attached to exactly one platform.

Help the Atlanteans maximize their above-water section: given the locations of the foundation points and the minimum and maximum allowed platform lengths, determine the maximum possible sum of platform lengths.

입력

The first line of input contains three space separated integers $n$ (1ドル \le n \le 10^5$), $s$ and $k$ (1ドル \le s \le k \le 10^5$), where $n$ is the number of foundation points, $s$ is the smallest platform length possible, and $k$ is the largest platform length possible.

Each of the next $n$ lines contains a single integer $x$ (1ドル \le x \le 10^9$), representing the location of a foundation point. No two foundation points will be the same.

출력

Output a single integer, which is the maximum possible sum of platform lengths, or $-1$ if it isn't possible to place the platforms.

제한

예제 입력 1

4 1 4
1
6
8
10

예제 출력 1

11

예제 입력 2

5 1 6
6
7
8
3
5

예제 출력 2

7

예제 입력 3

2 5 10
1
2

예제 출력 3

-1

힌트

출처

ICPC > Regionals > North America > North America Qualification Contest > ICPC North America Qualifier 2022 H번

  • 문제를 만든 사람: Travis Meade
(追記) (追記ここまで)

출처

대학교 대회

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

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