#P10059. Choose
Choose
Description
Given a sequence of length .
You need to select different contiguous subsequences of , all with length : $C(a,l_1,l_1+L-1),C(a,l_2,l_2+L-1),\dots,C(a,l_k,l_k+L-1)$, where .
Let the minimum range among these subsequences be . You need to find the maximum possible value of . Also, when is maximized, you need to find the minimum possible value of .
Input Format
This problem contains multiple test cases.
The first line contains an integer , the number of test cases.
For each test case:
- The first line contains two integers .
- The second line contains integers .
Output Format
For each test case:
- Output one line with two integers , representing the required range and the subsequence length.
3
5 1
1 2 3 4 5
5 2
1 2 3 4 5
5 3
1 2 3 4 5
4 5
3 4
2 3
2
5 1
1 2 2 2 3
5 2
1 2 2 2 3
2 5
1 2
Hint
[Sample 1 Explanation]
- When , the maximum possible range is at most . One shortest valid choice is .
- When , the maximum possible range is at most . One shortest valid choice is and .
- When , the maximum possible range is at most . One shortest valid choice is , , and .
[Constraints and Notes]
This problem uses bundled testdata.
| Subtask | Score | Special Property | ||
|---|---|---|---|---|
| All are equal | ||||
| Testdata is randomly generated | ||||
| The required is at most | ||||
| None | ||||
For of the testdata, , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号