#P6492. [COCI 2010/2011 #6] STEP

[COCI 2010/2011 #6] STEP

Description

Given a character sequence aa of length nn, initially all characters in the sequence are L.

There are qq modifications. Each time, an integer xx is given. If axa_x is L, then change axa_x to R; otherwise change axa_x to L.

For a string ss consisting only of L and R, if there are no consecutive L and R in it, then ss is considered to satisfy the requirement.

After each modification, output the length of the longest contiguous substring in the current sequence aa that satisfies the requirement.

Input Format

The first line contains two integers, representing the length of the sequence nn and the number of modification operations qq.

The next qq lines each contain one integer, representing the position xx 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 aa 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 1n,q2×1051 \leq n, q \leq 2 \times 10^5, 1xn1 \leq x \leq n.

Notes

This problem is translated from COCI2010-2011 CONTEST #6 T5 STEP. Translation by @一扶苏一.

Translated by ChatGPT 5