题目描述
Problem Description
E869120 decided to present a sequence to square1001 for his birthday every year for the next $Q$ years. Since square1001 mentioned that shorter sequences are more compact and preferable, E869120 wants to make the sequences as short as possible. Additionally, they need to adhere to the teachings of AtCoder, which are as follows:
- All elements in the sequence must be distinct.
- The number of distinct increasing subsequences that appear as subsequences in the presented sequence must exactly match the sacred number $K$.
A "subsequence" of a sequence $A = (A_1, A_2, ..., A_N)$ is a sequence that can be formed by removing zero or more elements from $A$ without changing the order of the remaining elements. A sequence $A = (A_1, A_2, ..., A_N)$ is considered "increasing" if $A_1 < A_2 < ... < A_N$.
For example, for $A = (3, 4, 1, 2)$, the increasing subsequences are $(), (1), (2), (3), (4), (1, 2), (3, 4)$, totaling 7.
At AtCoder, the "sacred number" changes every year. Specifically, the sacred number for the $i$-th year is $K_i$. Please determine the sequence that should be presented in the $i$-th year for E869120.
Input Format
The input is given from the standard input in the following format:
$Q$ $K_1$ $K_2$ $K_3$ ... $K_Q$
Output Format
Output $Q$ lines as follows:
($Information of the sequence for the 1st year$) ($Information of the sequence for the 2nd year$) ($Information of the sequence for the 3rd year$) ... ($Information of the sequence for the Q-th year$)
The information of the sequence should be output as:
$N$ $A_1$ $A_2$ $A_3$ ... $A_N$
The output sequence must satisfy the following conditions:
- $0 \leq N \leq 128$
- $0 \leq A_i \leq 999$
- $A_i \neq A_j (i \neq j)$
Sample Input and Output
Sample Input #1
2
5
10
Sample Output #1
3 2 3 1
6 8 6 9 1 2 0
Sample Input #2
3
20
100
869120
Sample Output #2
9 9 7 3 6 5 8 4 1 2
10 0 5 9 3 6 1 4 2 7 8
72 47 45 28 9 41 50 33 61 27 15 38 54 52 22 57 7 30 12 46 21 19 8 71 20 23 6 18 26 17 39 4 53 44 3 31 68 29 42 62 37 69 67 40 65 2 55 36 35 11 49 24 25 43 48 0 1 16 10 70 66 64 32 5 51 60 63 58 56 59 13 14 34
Notes/Hints
Constraints
- $Q$ is an integer between 1 and 1,000 inclusive.
- $K_i$ is an integer between 1 and $5 \times 10^{18}$ inclusive.
Subtasks and Points
- (30 points): $K_i \leq 100$
- (70 points): $K_i \leq 1,500$
- (1400 points): No additional constraints.
For subtask 3, the score is determined as follows: Let $L$ be the maximum value of $N$ over the $Q$ years, and $L'$ be the maximum value of $L$ across all test cases.
- If $120 \leq L' \leq 128$, the score for this subtask is 125 points.
- If $100 \leq L' \leq 119$, the score for this subtask is $1400 \times 5^{-(L' - 99) / 20}$ points.
- If $0 \leq L' \leq 99$, the score for this subtask is 1400 points.
Sample Explanation 1
For the 1st year, the sequence to be presented is $(2, 3, 1)$. This sequence has 5 increasing subsequences: $(), (1), (2), (3), (2, 3)$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分