Time Limit: 0.5 second(s) | Memory Limit: 64 MB |
Initially you are given an array of integers. Then you are asked q times what is the XOR of all the values in the given range.
Input
Input starts with an integer T (≤ 5), denoting the number of test cases.
Each case starts with a line containing an integer n (1 ≤ n ≤ 10^5) denoting the total number of integers on the next line. Next line contains n integers(1 ≤ i ≤ 10^5). Then there is an integer q(number of queries) (1 ≤ q ≤ 5 * 10^4) . Next q lines contain 2 integers u and v(1 ≤ u ≤ v ≤ n). For each query you have to print XOR of all integers between the range (inclusive).
Output
For each query print your answer in a line. See sample input/output for details.
Sample Input |
Output for Sample Input |
1 5 1526 5645 215 214 878 4 1 5 2 2 3 5 2 5 |
Case 1: 4244 5645 879 5474 |
Developed and Maintained by
JANE ALAM JAN |
Copyright © 2012
LightOJ, Jane Alam Jan |