#P14188. [ICPC 2024 Hangzhou R] Barkley III
[ICPC 2024 Hangzhou R] Barkley III
题目描述
There are little pigs in Pigeland. All of them are proficient in competitive programming, and the -th of them has rating. If pigs form a team, the rating of the team will be $a_{p_1}\ \&\ a_{p_2}\ \&\ a_{p_3}\ \& \cdots \&\ a_{p_k}$, where denotes the bitwise AND operation.
There are some programming contests to take place. Pigeland can send exactly one team to participate in each contest. For the -th competition, only the pigs numbered between and (both inclusive) have time to participate. Unfortunately, due to a shortage of funds, exactly one pig numbered between and has to be removed. Meanwhile, all other pigs in the interval will participate in the contest. Pig-head, the coach of Pigeland, needs to properly select pigs who will not participate so that the team's rating is maximized.
However, through training and participating in contests, the rating of pigs may be changed. As Pig-head's best friend, your task is to maintain the pigs' rating for the following events belonging to three types.
- : Pig-head changes the rating of each pig numbered between and (both inclusive) by executing the bitwise AND operation with . More formally, for all , becomes .
- : Pig-head changes the rating of the -th pig to .
- : Pig-head asks for the maximum rating when forming a team by selecting pigs numbered between and (both inclusive) and removing exactly one of them.
输入格式
There is only one test case in each test file.
The first line contains two integers and (, ) indicating the number of pigs and the number of events.
The second line contains integers () where indicates the rating of the -th pig.
For the following lines, the -th line first contains an integer () indicating the type of the -th event. If , then three integers , , and follow (, ); If , then two integers and follow (, ); If , then two integers and follow ().
输出格式
For each event of the third type, output one line containing one integer indicating the maximum rating of the team.
5 9
7 7 7 6 7
3 1 5
2 1 3
3 1 5
3 1 3
1 1 2 3
3 1 3
2 2 8
3 1 3
3 1 2
7
6
7
3
3
8