QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#13991. 神秘序列

統計

E.Space 做了一个梦。

他梦到了一个神秘的序列,有人告诉他,这个序列和明天的考试有一些密切的关联。他决心要把这个序列记住。

可醒来之后,E.Space 发现自己没有记住这个序列,甚至连序列的长度都不记得了。不过,他记得这个序列有一个神奇的性质。

在梦中,E.Space 对它进行了一系列的操作。

记这个序列为 $a_1,a_2,\cdots,a_n$,开始时它满足 $\forall 1\le i\le n,~a_i\ge0$,并且 $a_n\ne 0$。

之后,E.Space 在每次操作时选择一个满足 $a_i=i$ 的 $i$,将 $a_i$ 变为 $0$,并且将 $a_1,a_2,\cdots, a_{i-1}$ 分别变为原来的值加 $1$。

E.Space 记得,在 $n+k$ 次操作之后,这个序列变成了全 $0$ 序列,即 $a_1=a_2=\cdots=a_n=0$。

E.Space 知道可能有多个序列满足这个性质,但是他还是希望你告诉他一种可能的情况,因为,说不定所有满足这个性质的序列都可以在考试时派上用场呢。

他的考试成绩就交给你了。

输入格式

输入一行一个正整数 $k$。

输出格式

如果你找到了满足 E.Space 描述的性质的序列,那么输出两行。

第一行一个正整数 $n$。

第二行 $n$ 个非负整数,$a_1,a_2,\cdots,a_n$,其中 $a_n\ne0$,表示这个神秘序列。

如果存在多种可能的神秘序列,只需输出任意一种。

如果不存在这样的神秘序列,输出一行 Daydream! 来告诉 E.Space 他在做白日梦。

样例

输入

1

输出

2
1 2

样例

输入

5

输出

4
1 2 2 4

子任务

子任务 1(10 分):$k\le 6$

子任务 2(25 分):$k\le 10^6$

子任务 3(30 分):$k\le 10^{11}$,如果有解则保证存在一个解满足 $\forall 1\le i < n,~a_i\ne i$

子任务 4(28 分):$k\le 10^{11}$

子任务 5(7 分):$k\le 10^{12}$

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#501EditorialOpen来自仓库的文档Qingyu2026-01-01 10:32:56View

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.