#P15861. [LBA-OI R3 A] A_Step_Back

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

[LBA-OI R3 A] A_Step_Back

Background

Problem 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 1≤i≤∣a∣1 \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 ai∣aja_i \mid a_j.

You must ensure 2≤∣a∣≤1052\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, 0≤m≤1090\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(n−1)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.