P22288 [CodeChef] MINSZ
提高
题目描述

Consider an array A = {a_{1}, a_{2},...,a_{n}} of size n ≥ 1. If a_{k} = 2^{x} -1 for all 1≤ k ≤ n, for some integer x (1 ≤ x ≤ 60), then A is called interesting array.

You are given a number C. Find any interesting array A of minimum possible size such that $a_{1} \bigoplus a_{2} \bigoplus...\bigoplus a_{n} = C$, where $\bigoplus$ represents bitwise XOR operation.

If there exists multiple such arrays, output any one.

------ Input Format ------

  • First line will contain T, number of testcases. Then the testcases follow.
  • Each testcase contains single integer C on a single line.

------ Output Format ------

  • For each testcase, on the first line output the minimum possible size of array A satisfying the given property.
  • On the next line output the elements of array A in any order.

------ Constraints ------

$1 ≤ T ≤ 10^{5}$
$0 ≤ C < 2^{60}$
- It is guaranteed in the input that sum of lengths of arrays over all testcases does not exceed $10^{6}$.

----- Sample Input 1 ------
3
1
2
3
----- Sample Output 1 ------
1
1
2
1 3
1
3

----- explanation 1 ------
$\textbf{Test case}$ 1: $C=1$, $A$ can be $\{1\}$

$\textbf{Test case}$ 2: $C=2$, $A$ can be $\{1,3\}$

$\textbf{Test case}$ 3: $C=3$, $A$ can be $\{3\}$

输入格式

见题面

输出格式

见题面

样例输入
3 1 2 3
样例输出
1 1 2 1 3 1 3