题库练习 XOR and Favorite Number
← 上一题 下一题 →

A10247 | XOR and Favorite Number

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Bob has a favorite number $k$ and $a_{i}$ of length $n$ . Now he asks you to answer $m$ queries. Each query is given by a pair $l_{i}$ and $r_{i}$ and asks you to count the number of pairs of integers $i$ and $j$ , such that $l<=i<=j<=r$ and the xor of the numbers $a_{i},a_{i+1},...,a_{j}$ is equal to $k$ .

输入格式

The first line of the input contains integers $n$ , $m$ and $k$ ( $1<=n,m<=100000$ , $0<=k<=1000000$ ) — the length of the array, the number of queries and Bob's favorite number respectively.

The second line contains $n$ integers $a_{i}$ ( $0<=a_{i}<=1000000$ ) — Bob's array.

Then $m$ lines follow. The $i$ -th line contains integers $l_{i}$ and $r_{i}$ ( $1<=l_{i}<=r_{i}<=n$ ) — the parameters of the $i$ -th query.

输出格式

Print $m$ lines, answer the queries in the order they appear in the input.

输入输出样例

输入 #1
6 2 3
1 2 1 1 0 3
1 6
3 5
输出 #1
7
0
输入 #2
5 3 1
1 1 1 1 1
1 5
2 4
1 3
输出 #2
9
4
4
C++ 编辑器
输入
输出