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

19076번 - Competition 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB38302583.333%

문제

A wrestling competition will be held tomorrow. A total of $n$ players will take part in it. The $i$-th player's strength is $a_i$.

If there is a match between the $i$-th player and the $j$-th player, the result will depend solely on $|a_i - a_j|$. If $|a_i - a_j| > K,ドル the player with the higher strength will win. Otherwise, each player will have a chance to win.

The competition rules are a little strange. For each fight, the referee will choose two players from all remaining players uniformly at random and hold a match between them. The loser will be eliminated. After $n - 1$ matches, the last remaining player will be the winner.

Given the numbers $n$ and $K$ and the array $a,ドル find how many players have a chance to win the competition.

입력

The first line of the input contains two integers $n$ and $K$ (1ドル \leq n \leq 10^5,ドル 0ドル \leq K < 10^9$).

The second line contains $n$ integers $a_i$ (1ドル \leq a_i \leq 10^9$).

출력

Print a single line with a single integer: the number of players which have a chance to win the competition.

제한

예제 입력 1

5 3
1 5 9 6 3

예제 출력 1

5

예제 입력 2

5 2
1 5 9 6 3

예제 출력 2

1

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2017 > Day 4: Ruyi Ji Contest 2 K번

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

출처

대학교 대회

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

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