ICHB Selection Contest '17 Problem 3 - Parallel Universe
View as PDFYou are locked in a parallel universe and for you to be able to escape you have to answer  queries on an array named 
 with 
 elements. The queries are as follows:
U x val- Change the value ofto
.
Q x y val- Print. Here,
refers to bitwise AND.
Constraints
For all subtasks:
Subtask 1 [25%]
Subtask 2 [30%]
There will be at most  
Q queries.
Subtask 3 [45%]
No additional constraints.
Input Specification
On the first line, you will find  and 
.
On the second line, you will find  numbers, where the 
 number is 
.
On the next  lines, you will find the queries.
Output Specification
For each Q type query, print each result on a different line.
Sample Input
3 3
5 7 15
Q 1 3 7
U 1 0
Q 1 3 15
Sample Output
5
0
Comments