Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

December challenge -xor of subarray

$
0
0

Hi, In the problem "chef and easy xor queries" of the current december challenge , we need to output the 'number of magical subarrays whose xor of all elements is equal to a certain number'.Can someone explain what 'xor of all elements means'?I had presumed it was the xor was commutative ie (a^b^c) was the same as (a^b)^c,but in the given example , ie the array 1 1 1 1 1 , the number of magical subarrays with xor=1 is 3.How?I can work out the answer to be 2 as the only subarrays with xor 1 are ((a[0]^a[1])^a[2])and(a[0]^a[1]^a[2]^a[3])^a[5]`

Is there something I am not getting?(Not about the problem,but about the concept of xor queries..)


Viewing all articles
Browse latest Browse all 39796

Latest Images

Trending Articles



Latest Images