문제
Bessie is looking for a new job! Fortunately,
The interview process will go as follows. At time
For each
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
The second line will contain
출력
On the first line, print the time Bessie's interview will begin.
On the second line, a bit string of length
부분문제
| 번호 | 점수 | 조건 |
|---|---|---|
| #1 | 20점 | No two farmers finish at the same time. |
| #2 | 30점 | |
| #3 | 50점 | 추가 제약 조건 없음 |
예제
6 3
3 1 4159 2 6 5
8
110
There are
At time
t = 0 , farmer1 interviews cow1 , farmer2 interviews cow2 , and farmer3 interviews cow3 .At time
t = 1 , farmer2 finishes his interview with cow2 and starts interviewing cow4 .At time
t = 3 , both farmer1 and farmer2 finish their interviews, and there are two possibilities:Farmer 1 interviews cow 5 and farmer 2 interviews cow 6. In this case, farmer 2 would finish his interview at time t = 8 and start interviewing Bessie.
Farmer
1 interviews cow6 and farmer2 interviews cow5 . In this case, farmer1 would finish his interview at timet = 8 and start interviewing Bessie.
Thus, Bessie's interview will begin at time