#P8773. XOR Pair Query in a Subarray
XOR Pair Query in a Subarray
XOR Pair Query in a Subarray
You are given a sequence (A_1, A_2, \cdots, A_n) of length (n) and a non-negative integer (x). There are (m) queries. In each query, you are given an interval ([l, r]) and you have to determine whether it is possible to choose two distinct numbers from the subarray (A_l, A_{l+1}, \ldots, A_r) such that their bitwise XOR is equal to (x), i.e. $$A_i\oplus A_j=x$$ for some (l \le i<j \le r).
inputFormat
The first line contains three integers (n), (m) and (x) where (n) is the length of the sequence, (m) is the number of queries, and (x) is the target XOR value. The second line contains (n) space-separated integers (A_1, A_2, \ldots, A_n). Each of the next (m) lines contains two integers (l) and (r) representing a query.
outputFormat
For each query, output a line containing Yes
if there exists a pair of distinct indices (i) and (j) (with (l \le i<j \le r)) such that (A_i\oplus A_j=x), otherwise output No
.
sample
5 3 2
1 3 5 7 9
1 3
2 5
1 5
Yes
Yes
Yes
</p>