Spacious Sets
시간 제한20초메모리 제한1024 MB
서로 다른 정수들과 간격 K가 주어질 때, 각 원소를 포함하면서 모든 쌍의 차이가 K 이상인 최대 부분집합의 크기를 구한다.
문제
Ada and John are best friends. Since they are getting bored, Ada asks John to solve a puzzle for her.
A set is considered spacious if the absolute difference between each pair of distinct elements of is at least , that is, for all , with .
Ada has a list of distinct integers of size , and an integer . For each , she asks John to find the maximum size of a set made of elements from , such that contains and is spacious.
Note: The sets do not need to be made of consecutive elements from the list.
입력
The first line of the input gives the number of test cases, . test cases follow.
The first line of each test case contains two integers and .
The next line contains integers .
출력
For each test case, output one line containing Case #x: y1 y2 ... yN$, where is the test case number (starting from 1) and is the maximum size of a spacious set of elements from that contains .
제한
- .
- , for all .
- , for all .
힌트
In Sample Case #1, a spacious set cannot contain and , nor it can contain and . That implies that and using makes them of maximum size.
In Sample Case #2, possible sets of maximum size are:
- ,
- , and
- .