HDU-1754-I Hate It (single-point update interval + query)

A more popular habit of many schools. The teachers really like to ask, so and so to so and so from among the highest score is. 
This allows many students are disgusted. 

Whether you like it or not, now you need to do is, it is in accordance with the requirements of the teacher, to write a program to simulate the teacher asked. Of course, teachers sometimes need to update certain students achievements.

Input this title has multiple sets of test, to deal with the end of the file. 
In the first line of each test, there are two positive integers N and M (0 <N <= 200000,0 <M <5000), represents the number of operations and the number of students. 
Student ID numbers are compiled from 1 to N. 
The second line contains N integers, representing the N initial student grades, where the i-th student ID is representative of the results i. 
The next M rows. Each line has a character C (just take 'Q' or 'U'), and two positive integers A, B. 
When C is the 'Q' time, that this is a query operation, it queries the ID from A to B (including A, B) among the students, the highest score is. 
When C is the 'U' time, that this is an update operation, the ID required to change grades A student B. 
Output For each query operation, which outputs the highest score in a row. Sample Input

5 6
1 2 3 4 5
Q 1 5
U 3 6
Q 3 4
Q 4 5
U 2 9
Q 1 5

Sample Output

5
6
5
9


        
 

Hint

Huge input,the C function scanf() will work better than cin
        
 

Guess you like

Origin www.cnblogs.com/Staceyacm/p/11287776.html