You are given a positive integer x. You should insert x into s. For each ys before this query such that yx, you should also insert yx into s ( denotes the xor operation). Then, you should find two values e and o: the number of elements of s with an even number of 1-s and with an odd number of 1-s in the binary re, respectively.
Answers
Answer:
Step-by-step explanation:
Given an array of N numbers, and a number of queries where each query will contain three numbers(l, r and k). The task is to calculate the number of array elements which are greater than K in the subarray[L, R].
Examples:
Input: n=6
q=2
arr[ ] = { 7, 3, 9, 13, 5, 4 }
Query1: l=1, r=4, k=6
Query2: l=2, r=6, k=8
Output: 3
2
For the first query, [7, 3, 9, 13] represents the
subarray from index 1 till 4, in which there are
3 numbers which are greater than k=6 that are {7, 9, 13}.
For the second query, there are only
two numbers in the query range which
are greater than k.
Hope it helps you...