1302. Sum of one-sequence

单点时限: 2.0 sec

内存限制: 256 MB

We say that a sequence of integers is a one-sequence if the difference between any two consecutive numbers in this sequence is $1$ or $-1$ and its first element is $0$. More precisely: $[a_1,a_2,\ldots,a_n]$ is a one-sequence if

  1. for any $k$, such that $1 \le k< n$: $|a_k-a_{k+1}| =1$ and
  2. $a_1=0$

Write a program that:

  1. reads two integers describing the length of the sequence and the sum of its elements;
  2. finds a one-sequence of the given length whose elements sum up to the given value or
  3. states that such a sequence does not exist.

输入格式

The number of test cases $t$ is in the first line of input, then $t$ test cases follow separated by an empty line.

In the first line of a test case there is a number $n$, such that $1 \le n \le 10~000$, which is the number of elements in the sequence. In the second line there is a number $S$, which is the sum of the elements of the sequence, such that $|S| \le 50~000~000$.

输出格式

For each test case there should be written $n$ integers (each integer in a separate line) that are the elements of the sequence ($k$-th element in the $k$-th line) whose sum is $S$ or the word No if such a sequence does not exist. If there is more than one solution your program should output any one.

Consequent test cases should by separated by an empty line.

样例

Input
1
8
4
Output
0
1
2
1
0
-1
0
1

6 人解决,10 人已尝试。

8 份提交通过,共有 26 份提交。

7.3 EMB 奖励。

创建: 16 年前.

修改: 6 年,6 月前.

最后提交: 1 年前.

来源: POI 1998 I Stage

题目标签