QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 1024 MB 總分: 100

#8349. Zero Sum

统计

Given $K$, you need to construct a sequence $(A_i)_{i=1}^n$ of length $n$ such that:

  1. $A_i$ are integers between $-10^{16}$ and $10^{16}$.
  2. There are exactly $K$ subsets $S$ of $\{1, 2, \dots, n\}$ such that $\sum_{i \in S} A_i = 0$ (including the empty set).
  3. $n$ is an integer between $0$ and $30$.

Input

The input contains multiple test cases.

The first line contains an integer $T$, the number of test cases.

Each of the next $T$ lines contains an integer $K$, the query parameter.

Output

For each test case, output two lines. The first line contains an integer $n$, the length of the sequence. The second line contains $n$ integers representing the sequence.

Examples

Input 1

2
3
16

Output 1

5
2021 -1000 -1021 -2000 -21
4
0 0 0 0

Subtasks

Subtask ID $K\leq$ Score
1 10 15
2 100 15
3 2000 15
4 10000 15
5 100000 15
6 1000000 25

For all test cases, it is guaranteed that $1 \leq T \leq 1000$ and $1 \leq K \leq 10^6$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.