#P7906. [Ynoi2005] rpxleqxq
[Ynoi2005] rpxleqxq
Problem Description
You are given a sequence of length consisting of positive integers, and a constant .
Let denote the bitwise XOR of and .
There are queries. Each query gives an interval . You need to find how many pairs in this interval satisfy .
Input Format
The first line contains two positive integers , representing the length of the sequence and the given constant.
The next line contains integers representing the sequence .
The third line contains a positive integer , representing the number of queries.
The next lines each contain two positive integers , representing one query.
Output Format
Output lines. Each line contains one integer, representing the answer.
11 4
11 4 5 1 4 1 9 1 9 8 10
5
1 4
1 9
1 9
8 10
8 10
2
12
12
1
1
Hint
Idea: Dpair, Solution: Dpair, Code: Dpair, Data: Dpair & nzhtl1477.
For of the testdata, it is the sample.
For another of the testdata, .
For another of the testdata, .
For another of the testdata, .
For another of the testdata, .
For of the testdata, , and .
Translated by ChatGPT 5