#2794. Handstand
Handstand
Handstand
题目描述
people are arranged in a row from left to right. You are given a string of length consisting of and , and a positive integer . The -th person from the left is standing on feet if the -th character of is , and standing on hands if that character is . You will give the following direction at most times (possibly zero): Direction: Choose integers and satisfying , and flip the -th, -th, , and -th persons. That is, for each , the -th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands. Find the maximum possible number of consecutive people standing on hands after at most directions.
输入格式
Input is given from Standard Input in the following format:
输出格式
Print the maximum possible number of consecutive people standing on hands after at most directions.
5 1
00010
4
14 2
11101010110011
8
1 1
1
1
提示
is an integer satisfying . is an integer satisfying . The length of the string is . Each character of the string is or .We can have four consecutive people standing on hands, which is the maximum result, by giving the following direction:
Give the direction with , which flips the first, second and third persons from the left.
No directions are necessary.
标签: AtCoder|abc124D
来源
AtCoder|abc124D