#P12356. 「HCOI-R2」Rabbit Panic (Hard Ver.)
「HCOI-R2」Rabbit Panic (Hard Ver.)
Description
You have a sequence where initially .
Each time you can choose distinct numbers , and simultaneously set all of into their mean. Note that the mean may not be an integer. In this case, it will never be rounded.
You need to minimize the number of operations to make .
Input Format
Each test consists of multiple test cases. The first line contains a single integer --- the number of sets of test cases. The description of each test case follows.
In each test case, the only line contains two integers --- () and (), representing the length of the sequence and the number .
It's guaranteed that the sum of over all testcases does not exceed .
Output Format
For each test case, on the first line, output the minimum number of operations, .
On the next lines, each line contains distinct integers in the range representing an operation.
If there's no solution, just print .
If there are multiple solutions, print any.
1
6 4
2
1 2 5 6
2 3 4 5
Hint
Sample #1
- $[1,2,3,4,5,6]\to [3.5,3.5,3,4,3.5,3.5]\to [3.5,3.5,3.5,3.5,3.5,3.5]$。
- There may be different but valid solutions.
Constraints
This problem uses subtasks.
Note that the full score of this problem in this contest is . Your actually score is half of the subtask scores displayed below.
- Subtask 0 (20 pts): .
- Subtask 1 (40 pts): .
- Subtask 2 (40 pts): No Special Constraints.
It is guaranteed that , , .
京公网安备 11011102002149号