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

22043번 - The Final Countdown 서브태스크스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB26000.000%

문제

Rumor has it that IOI 2048 is going to be held in Innopolis! In this regard, a large display counter was installed in Innopolis, indicating the number of nanoseconds before the start of the Olympiad! Initially, a certain number was set to be displayed, and every nanosecond this number decreases by one. Leading zeros are not displayed.

The digits are displayed using standard seven-segment indicators. The way the digits look is shown in the picture:

Nanoseconds change so quickly that it’s almost impossible to see the number the display shows at the moment. But, by connecting a high-precision sensor attached to the power cord of the display, it was possible to obtain the values $a_i$ — the number of segments turned on during the each of $n$ nanoseconds in a row. Since there is still time before IOI 2048, the number on the timer at any time was positive.

Write a program that calculates the number of possible initial values (corresponding to the measurement $a_1$), and any $m$ of these values. If the number of possible initial values are less than $m,ドル you should print all of them.

입력

The first line contains two numbers $n$ and $m$ (1ドル \le n \le 10^5,ドル 0ドル \le m \le 10$) — the number of nanoseconds and the number of values to print. The next line contains $n$ integers $a_i$ (2ドル \le a_i \le 1000$) — the number of segments that are turned on during the $i$-th nanosecond.

출력

In the first line print $k$ — the number of possible initial values of the counter modulo 1ドル,000円,000円,007円$. Then, print $m$ different initial values of the number on the display, consistent with the given measurements. If the actual number of values (before taking it modulo 1ドル,000円,000円,007円$) is less than $m,ドル print all the suitable values. You can print these numbers in any order, each one in a separate line.

제한

서브태스크

번호배점제한
117

$n = 1,ドル $m = 0,ドル $a_i \le 100$

210

$n = 1,ドル $m \le 10,ドル $a_i \le 100$

319

$n \le 100,ドル $a_i \le 10$

422

$n \le 100,ドル $a_i \le 20$

532

No additional constraints

예제 입력 1

5 1
11 15 14 15 11

예제 출력 1

3
1151

예제 입력 2

10 1
13 10 14 12 13 9 12 11 10 11

예제 출력 2

1
102

예제 입력 3

4 10
29 28 29 29

예제 출력 3

108637
448765
812225
19541715
417773115
161177415
117347175
206215
8127315
12761415
54110175

예제 입력 4

1 6
6

예제 출력 4

6
111
41
14
6
77
9

힌트

In the first example, if initial value on the display is 1151, then it changes in the following way:

Number on the display Number of segments
1151 2ドル + 2 + 5 + 2 = 11$
1150 2ドル + 2 + 5 + 6 = 15$
1149 2ドル + 2 + 4 + 6 = 14$
1148 2ドル + 2 + 4 + 7 = 15$
1147 2ドル + 2 + 4 + 3 = 11$

Other possible initial values are 451 and 761, you can print any of them.

출처

Contest > Innopolis Open in Informatics > Innopolis Open 2019-2020 Finals C번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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