#P15861. [LBA-OI R3 A] A_Step_Back

    ID: 15469 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>洛谷原创Special JudgeO2优化构造洛谷月赛

[LBA-OI R3 A] A_Step_Back

Description

We use p|p| to denote the length of the sequence pp.

Given an integer mm, you are required to construct a sequence aa that satisfies:

  • For all 1ia1 \le i \le |a|, ai[1,106]a_i \in [1, 10^6].
  • There are exactly mm pairs (i,j)(i,j) such that i<ji<j and aiaja_i \mid a_j.

You must ensure 2a1052\le |a|\le 10^5 and minimize the length of the sequence. It can be proven that there exists a sequence aa with the minimal length a|a| satisfying the conditions.

The special scoring rules are detailed in the data constraints.

Input Format

A single integer mm on a line.

Output Format

The first line outputs the length nn of the sequence. The second line outputs nn integers separated by spaces, representing the constructed sequence.

0
2
114 514
15
6
1 4 16 64 512 32768

Hint

For 100%100\% of the data, 0m1090\le m\le 10^9.

Subtask ID mm Special Property Score
11 9\le 9 1010
33 170\le 170
22 2020
44 105\le 10^5 ^
55 Unrestricted 1010
66 ^ 3030

Special Property: There exists a positive integer nn such that

m=n(n1)2m=\frac{n(n-1)}{2}

Additionally, each test case has the following special scoring rule:

Let ss be the minimal possible length of aa, and ll be the length of your sequence aa. If the test case is worth PP points, you will obtain

$$\left\lfloor P\times \frac{\left\lfloor 100\cdot\left(\frac{s+114}{l+114}\right)^{1.14} \right\rfloor}{100} \right\rfloor$$

points. There may be minor differences due to precision issues.