Queries and Queries
Time limit2.5sMemory limit1024 MB
Given an array and M range-XOR updates, answer queries that XOR a range of update values by v and queries that XOR a range of the final array.
- Level
Hard8 of 10
- Topics
- Segment tree, Bit manipulation, Prefix sum, Array
- Solved
- No attempts yet
Problem
You are given an array of size . Apply the following update operation times to this array. Here is the bitwise XOR operation.
- : For every with , execute .
Write a program that answers the following queries.
- 1 : For every with , execute . Here is the value of in the -th update.
- 2 : Print in the array after all update operations have been applied.
Input
The first line contains , , and , separated by spaces. ()
The second line contains through , separated by spaces. ()
The next lines each contain three integers , , and , in that order. (, )
The next lines each contain a query, which is either 1 or 2 . (, , )
Output
For each query of type 2, print the answer on its own line.