Sequence and Queries 11
Time limit2sMemory limit512 MB
Given an array and integer K, answer queries counting subarrays within [l, r] whose XOR equals K.
- Level
Hard8 of 10
- Topics
- Prefix sum, Hash map, Divide and conquer, Binary search
- Solved
- No attempts yet
Problem
You are given a sequence of length and an integer . Write a program that processes the following query.
l r: print the number of pairs with such that the XOR of is .
Input
The first line contains the length of the sequence () and ().
The second line contains ().
The third line contains the number of queries ().
Each of the next lines contains one query , ().
Output
For each query, print the answer on its own line.