Longest Increasing Subsequence
题号:NC240732
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
Special Judge, 64bit IO Format: %lld

题目描述

Given an integer m, you need to construct a permutation p whose length does not exceed 100 such that there are exactly m longest increasing subsequences in p.

If multiple solutions exist, print any of them. If no solution exists, report it.

输入描述:

The first line contains an integer T , denoting the number of test cases.
Each test case contains an integer m in one line.

输出描述:

For each test case:
If no solution exists, print "-1" (without quotes) in one line.
Otherwise, print one integer n in the first line denoting the length of the permutation you construct. Then print n integers , in the second line denoting the permutation you construct.
示例1

输入

复制
2
3
5

输出

复制
4
2 4 1 3
5
3 2 5 1 4

说明

In the first test case, the length of the LIS (longest increasing subsequence) is 2, and the 3 LISs are \{2, 4\}, \{2, 3\}, \{1, 3\}.
In the second test case, the length of the LIS is 2, and the 5 LISs are \{3, 5\}, \{3, 4\}, \{2, 5\}, \{2, 4\}, \{1, 4\}.