#x1079. XOR and Favorite Number
XOR and Favorite Number
题面翻译
- 给定一个长度为 的序列 ,然后再给一个数字 ,再给出 组询问,每组询问给出一个区间,求这个区间里面有多少个子区间的异或值为 。
- ,,。
Translated by @char32_t,Reformed by @明依。
题目描述
Bob has a favorite number and of length . Now he asks you to answer queries. Each query is given by a pair and and asks you to count the number of pairs of integers and , such that and the xor of the numbers is equal to .
输入格式
The first line of the input contains integers , and ( , ) — the length of the array, the number of queries and Bob's favorite number respectively.
The second line contains integers ( ) — Bob's array.
Then lines follow. The -th line contains integers and ( ) — the parameters of the -th query.
输出格式
Print lines, answer the queries in the order they appear in the input.
样例 #1
样例输入 #1
6 2 3
1 2 1 1 0 3
1 6
3 5
样例输出 #1
7
0
样例 #2
样例输入 #2
5 3 1
1 1 1 1 1
1 5
2 4
1 3
样例输出 #2
9
4
4
提示
In the first sample the suitable pairs of and for the first query are: ( , ), ( , ), ( , ), ( , ), ( , ), ( , ), ( , ). Not a single of these pairs is suitable for the second query.
In the second sample xor equals for all subarrays of an odd length.