#P8773. [蓝桥杯 2022 省 A] 选数异或

[蓝桥杯 2022 省 A] 选数异或

Problem Description

Given a sequence A1,A2,,AnA_{1}, A_{2}, \cdots, A_{n} of length nn and a non-negative integer xx, there are mm queries. Each query asks whether it is possible to choose two numbers from some interval [l,r][l, r] such that their XOR equals xx.

Input Format

The first line contains three integers n,m,xn, m, x.

The second line contains nn integers A1,A2,,AnA_{1}, A_{2}, \cdots, A_{n}.

The next mm lines each contain two integers li,ril_{i}, r_{i}, representing the query interval [li,ri]\left[l_{i}, r_{i}\right].

Output Format

For each query, if there exist two numbers in the interval whose XOR is xx, output yes; otherwise output no.

4 4 1
1 2 3 4
1 4
1 2
2 3
3 3
yes
no
yes
no

Hint

[Sample Explanation]

Obviously, in the entire sequence, only the XOR of 2 and 3 equals 1.

[Test Case Scale and Constraints]

For 20%20\% of the test cases, 1n,m1001 \leq n, m \leq 100.

For 40%40\% of the test cases, 1n,m10001 \leq n, m \leq 1000.

For all test cases, 1n,m1051 \leq n, m \leq 10^5, 0x<2200 \leq x<2^{20}, 1lirin1 \leq l_{i} \leq r_{i} \leq n, and 0Ai<2200 \leq A_{i}<2^{20}.

Lanqiao Cup 2022 Provincial Contest A Group, Problem D.

Translated by ChatGPT 5