#P10923. [2015杭电多校]Gorgeous Sequence
[2015杭电多校]Gorgeous Sequence
Gorgeous Sequence
Problem Description
There is a sequence of length . We use to denote the -th element in this sequence. You should do the following three types of operations to this sequence. : For every , we use to replace the original 's value. : Print the maximum value of that . : Print the sum of that .
Input
The first line of the input is a single integer , indicating the number of testcases. The first line contains two integers and denoting the length of the sequence and the number of operations. The second line contains separated integers (). Each of the following lines represents one operation (). It is guaranteed that , .
Output
For every operation of type or , print one line containing the answer to the corresponding query.
Sample Input
1
5 5
1 2 3 4 5
1 1 5
2 1 5
0 3 5 3
1 1 5
2 1 5
Sample Output
5
15
3
12
Hint
Please use efficient IO method
Author
XJZX
Source
2015 Multi-University Training Contest 2