An Array and Addition Again
Given an array with elements numbered from to . Initially, for , and the last element is equal to .
The array can be modified using increment operations. To perform increment operations, it is necessary to select integers () and sequentially execute assignments for from to .
Given an integer , find the sequence of increment operations after which the element at the first position in array becomes equal to .
Input
The first line contains two integers and (, ) — the number of input sets and the test block number, respectively.
In the next lines, there is a single integer () — the value that should be equal to after performing the increment operations in the corresponding set.
Output
For each set of input data, output one integer () in the first line — the number of increase operations.
In the second line, output integers () — the parameters of the increase operations.
If there are multiple correct answers, you can output any of them.
Examples
1 0 1
99 99 98 ... 7 6 5 4 3 2 1
2 0 3 16
101 99 98 ... 7 6 5 4 3 2 1 1 1 103 99 98 ... 7 6 5 4 4 3 3 2 2 1 1
Note
For clarity, the examples of the input data in the problem statement have been reduced. To obtain the correct answer, replace "...
" with the sequence of integers from to .
Let's consider the second set of input data for the second example, where . The first 8 elements of the array after performing the next operation look as follows:
= 99, ;
= 98, ;
, ;
, ;
, ;
, ;
, ;
, ;
, ;
, ;
, ;
, ;
, .
Scoring
The first four test blocks allow using no more than 300 increment operations.
( points): ;
( points): for some integer ;
( points): for some integer ;
( points): is a Fibonacci number (i.e., is an element of the sequence where each element is the sum of the two previous ones: );
(up to points): without additional restrictions. Let the maximum number of increment operations used be . If , you will receive points, otherwise you will receive () points.
The C++
code that calculates the number of points for the last test block depending on the number of increment operations used is:
((c <= 300) ? 67 : (17 + (2000 - c) / 34))