#681
Unrated
Bessie's Interview
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Bessie is looking for a new job! Fortunately, KK farmers are currently hiring and conducting interviews. Since jobs are highly competitive, the farmers have decided to number and interview cows in the order they applied. There are NN cows that applied before Bessie, so her number is N+1N+1 (1KN31051 \leq K \leq N \leq 3 \cdot 10^5).

The interview process will go as follows. At time 00, farmer ii will start interviewing cow ii for each 1iK1 \leq i \leq K. Once a farmer finishes an interview, he will immediately begin interviewing the next cow in line. If multiple farmers finish at the same time, the next cow may choose to be interviewed by any of the available farmers, according to her preference.

For each 1iN1\le i\le N, Bessie already knows that cow ii's interview will take exactly tit_i minutes (1ti1091 \leq t_i \leq 10^9). However, she doesn't know each cow's preference of farmers.

Since this job is very important to Bessie, she wants to carefully prepare for her interview. To do this, she needs to know when she will be interviewed and which farmers could potentially interview her. Help her find this information!

입력

The first line of the input will contain two integers NN and KK.

The second line will contain NN integers t1tNt_1 \dots t_N.

출력

On the first line, print the time Bessie's interview will begin.

On the second line, a bit string of length KK, where the ii-th bit is 11 if farmer ii could interview Bessie and 00 otherwise.

예제 입력 1

6 3
3 1 4159 2 6 5

예제 출력 1

8
110

점수

Inputs 2-3: No two farmers finish at the same time.Inputs 4-9: N3103N\le 3\cdot 10^3Inputs 10-21: No additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.