ImaxRed and ImaxBlue are preparing for Christmas. They have a row of Christmas lights, each initially either blue or red. They have enough time to do swap operations. In each swap operation, a single light is switched with an adjacent one. Imaxblue would like to know the length of the longest possible sequence of consecutive blue lights after or fewer swaps. ImaxRed would like to know the same thing for red lights.
Input Specification
Line : Two space separated integers and .
Line : integers, either 1
or 0
, 1
representing a blue light and 0
representing a red light.
Output Specification
Two integers, the maximum number of consecutive blue lights after swaps, and the maximum number of consecutive red lights after swaps.
Sample Input
8 3
10101110
Sample Output
5 2
Explanation
We swap the following pairs (1-indexed): , , to get consecutive blue lights. allows us to have consecutive red lights. There is no combination that will result in more consecutive lights.
Comments