V Olimpiada Informatyczna 1997/1998
|
Task: SUM
|
Author: Grzegorz Jakacki
|
I stage contest |
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: [a1,a2,...,an] is a one-sequence if
Task
Write a program that:
Input
In the first line of the text file SUM.IN there is a number
n, such that 1<=n<=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| <= 50 000 000.
Output
In the first n lines of the text file SUM.OUT there should be
written n integers (one in each line) that are the elements of
the sequence (k-th element in the k-th line) whose sum is S
or the word NIE (which means NO in Polish) if such a sequence does
not exist.
Example
For the input file SUM.IN:
8 4the correct answer is the output file SUM.OUT:
0 1 2 1 0 -1 0 1