logo AlgoBeat OnlineJudge
登录 注册

#213058. [GCJ Farewell Round #2] Spacious Sets

内存限制:2048 MiB 时间限制:20000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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 # : , where is the test case number (starting from 1) and is the maximum size of a spacious set of elements from that contains .

样例

样例输入 1

2
3 2
1 2 3
6 4
2 7 11 19 5 3

样例输出 1

Case #1: 2 1 2
Case #2: 4 4 4 4 3 4

数据范围与提示

Sample Explanation

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
  • .

Limits

  • .
  • , for all .
  • , for all .

Test Set 1 (4 Pts, Visible Verdict)

  • .
  • .

Test Set 2 (10 Pts, Visible Verdict)

  • .

For at most 15 cases:

  • .

For the remaining cases:

  • .