#4306. At Most 3 (Contestant ver.)

0

At Most 3 (Contestant ver.)

At Most 3 (Contestant ver.)

题目描述

You are given an integer WW.
You are going to prepare some weights so that all of the conditions below are satisfied.

The number of weights is between 11 and 300300, inclusive. Each weight has a mass of positive integer not exceeding 10610^6. Every integer between 11 and WW, inclusive, is a good integer. Here, a positive integer nn is said to be a good integer if the following condition is satisfied: We can choose at most 33 different weights from the prepared weights with a total mass of nn.

Print a combination of weights that satisfies the conditions.

输入格式

Input is given from Standard Input in the following format: WW

输出格式

Print in the following format, where NN is the number of weights and AiA_i is the mass of the ii-th weight. If multiple solutions exist, printing any of them is accepted. NN A1A_1 A2A_2 …\dots ANA_N

Here, NN and A1,A2,…,ANA_1,A_2,\dots,A_N should satisfy the following conditions:

1≤N≤3001 \leq N \leq 300 1≤Ai≤1061 \leq A_i \leq 10^6

6
3
1 2 3
12
6
2 5 1 2 5 1

提示

1≤W≤1061 \leq W \leq 10^6 WW is an integer.在上面的输出中,准备了质量分别为 11、22 和 33 的 33 个砝码。
该输出满足条件。尤其是,关于第 33 条条件,我们可以确认每个介于 11 到 WW(含)之间的整数都是良好整数。

如果我们只选择第 11 个砝码,则总质量为 11。 如果我们只选择第 22 个砝码,则总质量为 22。 如果我们只选择第 33 个砝码,则总质量为 33。 如果我们选择第 11 个和第 33 个砝码,则总质量为 44。 如果我们选择第 22 个和第 33 个砝码,则总质量为 55。 如果我们选择第 11、第 22 和第 33 个砝码,则总质量为 66.
你可以准备质量相同的多个砝码。

标签: AtCoder|abc251D

来源

AtCoder|abc251D