问题3251--Subsequence

3251: Subsequence

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 64 MB

题目描述

There is a sequence of integers. Your task is to find the longest subsequence that satisfies the following condition: the difference between the maximum element and the minimum element of the subsequence is no smaller than m and no larger than k.

输入

There are multiple test cases. For each test case, the first line has three integers, n, m and k. n is the length of the sequence and is in the range [1, 100000]. m and k are in the range [0, 1000000]. The second line has n integers, which are all in the range [0, 1000000]. Proceed to the end of file.

输出

For each test case, print the length of the subsequence on a single line.

样例输入 Copy

5 0 0
1 1 1 1 1
5 0 3
1 2 3 4 5

样例输出 Copy

5
4