There are n benches near the Main Walkway in Summer Infomatics School. These benches are numbered by integers from 1 to n in order they follow. Also there are m cookie sellers near the Walkway. The i-th (1≤i≤m) cookie sellers is located near the si-th bench.
Petya is standing in the beginning of the Walkway. He will pass near all benches starting from the 1-st bench and ending with the n-th bench. Petya passes the distance between two consecutive benches in 1 minute. He has a knapsack with an infinite amount of cookies. Petya is going to eat cookies from his knapsack and buy them from cookie sellers during the walk.
Petya eats cookies only near the benches according to the following rule: he will eat the cookie near the i-th (1≤i≤n) bench if and only if at least one of the following conditions holds:
You may assume that Petya eats cookies instantly. Petya will not eat two or more cookies near the same bench.
You want to minimize the number of cookies Petya will eat during his walk. In order to do this, you will ask the administration of the Summer Informatics School to remove exactly one cookie seller from the Walkway before Petya starts his walk.
Please determine the minimum possible number of cookies Petya can eat after removing exactly one cookie seller. Also determine the number of cookie sellers, such that if you remove one of them, Petya will eat the minimum possible number of cookies.
Input
The first line contains a single integer t (1≤t≤10^3) — the number of test cases.
The first line of each test case contains three integers n, m and d (2≤d≤n≤10^9, 2≤m≤min(10^5,n)) — the number of benches, the number of cookie sellers and the value of parameter d from the statement, respectively.
The second line of each test case contains m integers s1,s2,…,sm (1≤si≤n) — the locations of the cookie sellers. It is guaranteed that si It is guaranteed that the sum of m over all test cases does not exceed 10^5. Output For each test case print two integers — the minimum number of cookies that Petya can eat if exactly one cookie seller is removed, and the number of cookie sellers such that if one of them is removed, Petya will eat the minimum possible number of cookies. input output 题意:有n个点,m个卖饼干的商人的坐标,d表示主人公走连续d个点至少吃一次饼干,主公人吃饼干的情况有3种: 1.该点有卖饼干的人 2.此前从来没吃过饼干(暗示点1必须吃一次饼干) 3.连续d个点至少吃一次饼干,问恰好移除一个商人使得主人公吃饼干的次数最少,且有多少种选择能达到最小值。 解析:我们可以预处理从点1到第 i 个商人所需吃的饼干数量和从点 n 到第 i 个商人所需吃的饼干数量,也就是前后缀和,此后我们枚举每一个商人,将其移除,贡献变化只受 i-1 和 i+1 的商人影响,计算出移除第 i 个商人的最终饼干数,和答案取min和计数即可。8
6 2 2
2 5
8 3 2
3 5 8
10 4 9
2 8 9 10
30 5 8
6 8 15 24 29
30 5 8
6 8 12 20 27
8 8 3
1 2 3 4 5 6 7 8
2 2 2
1 2
1000000000 3 20000000
57008429 66778899 837653445
3 1
4 1
4 4
6 4
5 2
7 7
1 1
51 1
#include