luogu#P4887. 【模板】莫队二次离线 / 第十四分块(前体)
【模板】莫队二次离线 / 第十四分块(前体)
Problem Description
Ctholly gives you a sequence . In each query, you are given an interval . You need to count the number of pairs such that , and the binary representation of contains exactly ones. Here, means bitwise XOR.
Input Format
The first line contains three integers , , and .
The second line contains integers representing the sequence .
Then follow lines. Each line contains two integers and , representing one query.
Output Format
Output lines, each containing one integer, which is the answer to the corresponding query.
5 5 2
3 4 8 0 2
4 5
3 5
1 4
2 5
1 5
0
1
2
3
4
Hint
For of the testdata, it is the sample.
For of the testdata, .
For of the testdata, the memory limit is 512 MiB.
For of the testdata, it is guaranteed that , and .
Translated by ChatGPT 5