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

22689번 - Goofy Converter 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 (추가 시간 없음) 512 MB48232146.667%

문제

Nathan O. Davis is a student at the department of integrated systems. He is now taking a class in in- tegrated curcuits. He is an idiot. One day, he got an assignment as follows: design a logic circuit that takes a sequence of positive integers as input, and that outputs a sequence of 1-bit integers from which the original input sequence can be restored uniquely.

Nathan has no idea. So he searched for hints on the Internet, and found several pages that describe the 1-bit DAC. This is a type of digital-analog converter which takes a sequence of positive integers as input, and outputs a sequence of 1-bit integers.

Seeing how 1-bit DAC works on these pages, Nathan came up with a new idea for the desired converter. His converter takes a sequence L of positive integers, and a positive integer M aside from the sequence, and outputs a sequence K of 1-bit integers such that:

$$L_j = \sum_{i=j}^{j+M-1}{K_i}\text{.}$$

He is not so smart, however. It is clear that his converter does not work for some sequences. Your task is to write a program in order to show the new converter cannot satisfy the requirements of his assignment, even though it would make Nathan in despair.

입력

The input consists of a series of data sets. Each data set is given in the following format:

N M
L0 L1 . . . LN-1

N is the length of the sequence L. M and L are the input to Nathan’s converter as described above. You may assume the followings: 1 ≤ N ≤ 1000, 1 ≤ M ≤ 12, and 0 ≤ LjM for j = 0, . . . , N - 1.

The input is terminated by N = M = 0.

출력

For each data set, output a binary sequence K of the length (N + M - 1) if there exists a sequence which holds the equation mentioned above, or “Goofy” (without quotes) otherwise. If more than one sequence is possible, output any one of them.

제한

예제 입력 1

4 4
4 3 2 2
4 4
4 3 2 3
0 0

예제 출력 1

1111001
Goofy

힌트

출처

Contest > ICPC Japanese Alumni Group > JAG Summer Camp > JAG Summer Camp 2007 Day 1 D번

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

출처

대학교 대회

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

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