#P2572. [SCOI2010] 序列操作
[SCOI2010] 序列操作
Description
lxhgww recently received a sequence containing numbers, indexed from . Each number is either or . There are five types of update and query operations on this sequence:
0 l rSet all numbers in the interval to .1 l rSet all numbers in the interval to .2 l rFlip all numbers in the interval , that is, change every to and every to .3 l rQuery how many s are in the interval .4 l rQuery the maximum number of consecutive s in the interval .
For each query operation, lxhgww needs to provide an answer. Clever programmers, can you help him?
Input Format
The first line contains two positive integers , representing the length of the sequence and the number of operations.
The second line contains numbers, representing the initial state of the sequence.
Then follow lines, each containing three integers, representing one operation.
Output Format
For each query operation, output one line with a single integer representing the corresponding answer.
10 10
0 0 0 1 1 0 1 0 1 1
1 0 2
3 0 5
2 2 2
4 0 4
0 3 6
2 3 7
4 2 8
1 0 5
0 5 6
3 3 9
5
2
6
5
Hint
Constraints
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号