Arora In Trouble..

0

0 votes
Data Structures, Medium, Approved, Recruit
Problem

Narang gave a problem to his friend, Arora. Narang gave Arora an integer array A of size N, Arora needs to perform 2 operations over this array :

  1. 0 L R : Find and print A[L] xor A[L+1] xor A[L+2] ... xor A[R]

  2. 1 X Y : Set the Xth elements of array A to value Y.

Arora being a commerce student could not code the problem.

Can you help Arora code this simple problem?

Input Format :

The first line contains a single integer N denoting the size of array A. The next line contains N space separated integers, where the ith element denotes A[i]. The third line contains the number of operations Q and then each of the remaining Q lines contain three space separated integers, where the ith line denotes the parameters of the ith query.

Output Format :

For each operation of the form 0 L R, display the answer for the operation in a separate line.

Input Constraints:

1N106

1Q105

0A[i]106

1LRN

1XN

1Y106

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?