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

31519번 - A Cappella Recording 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 2048 MB85675680.000%

문제

Geoffry is preparing an a cappella composition where he sings the entire song by himself.

Each note of the song has a pitch between 0ドル$ and 10ドル^9$. Because of the varying pitches in the song, Geoffry will record himself singing multiple times. In a single recording, he will pick some subset of the notes to sing and he will sing exactly those notes. To avoid straining his voice too much, within a single recording, there is a limit to the difference between the maximum pitch and the minimum pitch among the notes he sings.

Compute the minimum number of times that Geoffry can record himself singing the song and each note is sung in at least one of the recordings.

입력

The first line contains two integers $n$ and $d$ (1ドル \le n \le 10^5, 0 \le d \le 10^9$), where $n$ is the number of notes in Geoffry's song, and $d$ is the largest difference between the minimum pitch and the maximum pitch that Geoffry can handle.

Each of the next $n$ lines contains a single integer $p$ (0ドル \le p \le 10^9$). These are the pitches of the notes in Geoffry's song, in the order that they are to be sung.

출력

Output a single integer, which is the minimum number of times that Geoffry can record himself singing the song and each note is sung in at least one of the recordings.

제한

예제 입력 1

6 0
3
1
4
1
5
9

예제 출력 1

5

예제 입력 2

6 1
3
1
4
1
5
9

예제 출력 2

4

예제 입력 3

6 2
3
1
4
1
5
9

예제 출력 3

3

예제 입력 4

6 4
3
1
4
1
5
9

예제 출력 4

2

예제 입력 5

6 8
3
1
4
1
5
9

예제 출력 5

1

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2023 ICPC Pacific Northwest Region > Division 2 A번

ICPC > Regionals > North America > South Central USA Regional > 2023 South Central USA Regional Contest > Division 2 C번

ICPC > Regionals > North America > Mid-Atlantic Regional > 2023 Mid-Atlantic USA Regional Contest > Division 2 C번

ICPC > Regionals > North America > Southeast USA Regional > 2023 Southeast USA Regional Programming Contest > Division 2 C번

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

출처

대학교 대회

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

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