#PU639. USACO 2016 US Open Contest, Bronze — Problem 1. Diamond Collector

    ID: 1566 传统题 文件IO:diamond 2000ms 256MiB 尝试: 0 已通过: 0 难度: 普及 上传者: 标签>USACO赛事:open16来源:usaco.orgscoring:equal_test_cases排序

USACO 2016 US Open Contest, Bronze — Problem 1. Diamond Collector

USACO 2016 US Open Contest, Bronze — Problem 1. Diamond Collector

题目描述

Bessie the cow, always a fan of shiny objects, has taken up a hobby of mining diamonds in her spare time! She has collected NN diamonds (N≤1000N \leq 1000) of varying sizes, and she wants to arrange some of them in a display case in the barn. Since Bessie wants the diamonds in the case to be relatively similar in size, she decides that she will not include two diamonds in the case if their sizes differ by more than KK (two diamonds can be displayed together in the case if their sizes differ by exactly KK). Given KK, please help Bessie determine the maximum number of diamonds she can display in the case.

输入格式

The first line of the input file contains NN and KK (0≤K≤10,0000 \leq K \leq 10,000). The next NN lines each contain an integer giving the size of one of the diamonds. All sizes will be positive and will not exceed 10,00010,000.

输出格式

(见题面原文)

数据范围

(见题面原文)

样例

样例 1

5 3
1
6
4
3
1
4
Problem credits: Nick Wu