#P6492. [COCI 2010/2011 #6] STEP
[COCI 2010/2011 #6] STEP
Description
Given a character sequence of length , initially all characters in the sequence are L.
There are modifications. Each time, an integer is given. If is L, then change to R; otherwise change to L.
For a string consisting only of L and R, if there are no consecutive L and R in it, then is considered to satisfy the requirement.
After each modification, output the length of the longest contiguous substring in the current sequence that satisfies the requirement.
Input Format
The first line contains two integers, representing the length of the sequence and the number of modification operations .
The next lines each contain one integer, representing the position to be modified in this operation.
Output Format
For each modification operation, output one integer per line, representing the length of the longest substring in the sequence that satisfies the requirement.
6 2
2
4
3
5
6 5
4
1
1
2
6
3
3
3
5
6
Hint
Constraints
For all testdata, it is guaranteed that , .
Notes
This problem is translated from COCI2010-2011 CONTEST #6 T5 STEP. Translation by @一扶苏一.
Translated by ChatGPT 5
京公网安备 11011102002149号