P27065 [AtCoder] Exactly K Triangles
提高+
题目描述

Problem Description

Given a non-negative integer $ K $, construct a sequence of positive integers $A=(A_1,\ A_2,\ \ldots,\ A_N)$ that satisfies the following conditions:

  • There are exactly $ K $ integer triples $(i,\ j,\ k)$ $(1\ \leq\ i\ <\ j\ <\ k\ \leq\ N)$ such that there exists a triangle with positive area and sides of lengths $A_i,\ A_j,\ A_k$.

Input Format

The input is given from the standard input in the following format:

$ K $

Output Format

Output the sequence $ A $ in the following format:

$ N $ $ A_1 $ $ A_2 $ $\ldots$ $ A_N $

However, it must satisfy the following conditions:

  • $1\ \leq\ N\ \leq\ 2000$
  • $1\ \leq\ A_i\ \leq\ 10^{18}$
  • All outputs are integers
  • There are exactly $ K $ integer triples $(i,\ j,\ k)$ $(1\ \leq\ i\ <\ j\ <\ k\ \leq\ N)$ such that there exists a triangle with positive area and sides of lengths $A_i,\ A_j,\ A_k$.

Under these constraints, it can be proven that there is at least one sequence $ A $ that satisfies the conditions for any $ K $.

If there are multiple sequences $ A $ that satisfy the conditions, any one of them may be output.

Sample Input and Output

Sample Input #1

3

Sample Output #1

5
1 2 3 4 5

Sample Input #2

0

Sample Output #2

3
1 10 100

Sample Input #3

10

Sample Output #3

5
10 10 10 10 10

Notes/Hints

Constraints

  • $0\ \leq\ K\ \leq\ 10^9$
  • All inputs are integers

Sample Explanation 1

A triangle with positive area and sides $A_i,\ A_j,\ A_k$ exists for the triples $(i,\ j,\ k)\ =\ (2,3,4),\ (2,4,5),\ (3,4,5)$, which are exactly 3, satisfying the condition.

Sample Explanation 3

Original idea: NatsubiSogan

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3
样例输出
5 1 2 3 4 5