Question
One Emergency Lamp Switch
A tunnel has
The intuition trap: you do not need to actually flip every zero and test again.
Input
The first line contains KaTeX can only parse string typed expression. For each test case, the first line contains KaTeX can only parse string typed expression. The second line contains KaTeX can only parse string typed expression binary integers.
Output
For each test case, print the maximum length of a continuous segment containing only KaTeX can only parse string typed expressions after flipping at most one KaTeX can only parse string typed expression.
Example
Example 1:
Input
Example 2:
Input
Input
1
8
1 1 0 1 1 0 1 1Output5Example 2:
Input
1
5
0 0 0 0 0Output1