luogu#P4735. 最大异或和
最大异或和
Problem Description
You are given a sequence of non-negative integers with initial length .
There are operations of the following two types:
A x: an append operation, meaning that a number is appended to the end of the sequence, and the length increases by .Q l r x: a query operation. You need to find a position such that , to maximize , and output the maximum value.
Input Format
The first line contains two integers , as described above.
The second line contains non-negative integers, representing the initial sequence .
The next lines each describe one operation, in the format given in the statement.
Output Format
Suppose there are query operations. Output lines, each containing one integer, which is the answer to a query.
5 5
2 6 4 3 6
A 1
Q 3 5 4
A 4
Q 5 7 0
Q 3 6 6
4
5
6
Hint
- For all test cases, , .
Translated by ChatGPT 5