Call for Problems, Round 3

면접 대비

시간 제한1초메모리 제한2048 MB

요약
n개의 난이도 값이 주어질 때, 고른 값들 사이의 차이가 모두 t 이상이 되도록 최대 개수의 부분집합을 고른다.
난이도

쉬움10점 중 3점

유형
정렬, 그리디, 배열, 투 포인터
정답자
아직 제출이 없습니다

문제

The Call for Problems for the Pacific Northwest Regional has finished, and a number of problems were proposed. The judges voted on the difficulty of each problem. The Pacific Northwest Regional this year will feature some number of problems, and one of the goals is for no two problems to be too similar in difficulty.

Specifically, if two different problems have difficulty ratings d_id\_i and d_jd\_j, then the difference between the two must be at least tt.

Given the problems proposed, compute the maximum number of problems that can be put on the Pacific Northwest Regional.

입력

The first line contains two integers, nn and tt (1≤n≤50,1≤t≤25001 \le n \le 50, 1 \le t \le 2500).

The next line contains nn integers, the difficulties of the nn problems proposed. Each difficulty will be between 11 and 25002500.

출력

Output a single integer, the maximum number of problems that can be put on the Pacific Northwest Regional.

예제3

  1. 예제 1

    입력
    5 67
    1 68 1 68 1
    
    예상 출력
    2
    
  2. 예제 2

    입력
    3 67
    67 767 677
    
    예상 출력
    3
    
  3. 예제 3

    입력
    2 67
    67 1
    
    예상 출력
    1