201453: [AtCoder]ARC145 D - Non Arithmetic Progression Set

Memory Limit:1024 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $700$ points

Problem Statement

Construct a set $S$ of integers satisfying all of the conditions below. It can be proved that at least one such set $S$ exists under the Constraints of this problem.

  • $S$ has exactly $N$ elements.
  • The element of $S$ are distinct integers between $-10^7$ and $10^7$ (inclusive).
  • $ \displaystyle \sum _{s \in S} s = M$.
  • $ y-x\neq z-y$ for every triple $ x,y,z$ $(x < y < z)$ of distinct elements in $ S$.

Constraints

  • $1 \leq N \leq 10^4$
  • $|M| \leq N\times 10^6$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$N$ $M$

Output

Let $s_1,s_2,\ldots,s_N$ be the elements of $S$. Print a set $S$ that satisfies the conditions in the following format:

$s_1$ $s_2$ $\ldots$ $s_N$

If multiple solutions exist, any of them will be accepted.


Sample Input 1

3 9

Sample Output 1

1 2 6

We have $2-1 \neq 6-2$ and $1+2+6=9$, so this output satisfies the conditions. Many other solutions exist.


Sample Input 2

5 -15

Sample Output 2

-15 -5 0 2 3

$M$ may be negative.

Input

题意翻译

构造一个满足以下条件的整数集合 $S$。可以证明在本题的约束下一定存在至少一个。 - $S$ 里有恰好 $N$ 个元素。 - $\forall x\in S$,$-10^7\le x\le 10^7$,且 $x$ 两两不同。 - $\sum\limits_{x\in S} x=M$。 - $\forall x,y,z\in S$,若 $x<y<z$,则 $y-x\neq z-y$。 $1\le N\le 10^4$,$|M|\le N\times 10^6$。

加入题单

上一题 下一题 算法标签: