#P6608. [Code+#7] 神秘序列

[Code+#7] 神秘序列

Description

E.Space had a dream.

He dreamed of a mysterious sequence. Someone told him that this sequence is closely related to tomorrow’s exam.

He decided to memorize this sequence. But after waking up, E.Space found that he did not remember the sequence, not even its length. However, he remembered that this sequence has a magical property.

In the dream, E.Space performed a series of operations on it. Let the sequence be a1,a2,,ana_1, a_2, \dots, a_n. Initially, it satisfies 1in,ai0\forall 1\le i\le n, a_i \ge 0, and an0a_n \neq 0.

After that, in each operation, E.Space chooses an ii such that ai=ia_i=i, sets aia_i to 00, and increases each of a1,a2,,ai1a_1, a_2, \dots, a_{i-1} by 11 from its original value.

E.Space remembers that after n+kn+k operations, this sequence becomes the all-zero sequence, i.e. a1=a2==an=0a_1=a_2=\cdots=a_n= 0.

E.Space knows that there may be multiple sequences that satisfy this property, but he still hopes you can tell him one possible case, because maybe all sequences that satisfy this property could be useful in the exam.

His exam score is in your hands.

Input Format

One line contains one positive integer kk.

Output Format

If you find a sequence that satisfies the property described by E.Space, output two lines.

The first line contains one positive integer nn.

The second line contains nn non-negative integers a1,a2,,ana_1, a_2, \dots, a_n, where an0a_n \neq 0, representing this mysterious sequence.

If there are multiple possible mysterious sequences, output any one. If no such mysterious sequence exists, output one line Daydream! to tell E.Space that he is daydreaming.

1
2
1 2
5
4
1 2 2 4

Hint

Subtask 11 (10 points): k6k\le 6.

Subtask 22 (25 points): k106k\le 10^6.

Subtask 33 (30 points): k1011k\le 10^{11}. If a solution exists, it is guaranteed that there exists a solution satisfying 1i<n,aii\forall 1\le i< n, a_i \neq i.

Subtask 44 (28 points): k1011k\le 10^{11}.

Subtask 55 (7 points): k1012k\le 10^{12}.

Translated by ChatGPT 5