Logo
(追記) (追記ここまで)

8071번 - One-sequence 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB106624158.571%

문제

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:

  • for any k, such that 1 ≤ k < n: |ak - ak+1| = 1 and
  • a1 = 0.

Write a program that:

  • reads two integers describing the length of the sequence and the sum of its elements, from the standard input;
  • finds a one-sequence of the given length whose elements sum up to the given value or states that such a sequence does not exist;
  • writes the result to the standard output.

입력

In the first line of the standard input 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.

출력

In the first n lines of the standard output 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.

제한

예제 입력 1

8
4

예제 출력 1

0
1
2
1
0
-1
0
1

힌트

출처

Olympiad > Polish Olympiad in Informatics > POI 1997/1998 > Stage 1 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /