CHEFEXQ - Unofficial Editorial

Problem link: CHEFEXQ

Given an array of n elements and q queries of 2 types:

  • type 1: Given two numbers p and x, the value at index p should be updated to x.

  • type 2: Given two numbers p and x, calculate total number of subarrays whose starting index is 0 and the last index is ≤ p and the xor of all elements in that subarray is equal to x.


This problem can be solved using square root decomposition technique. I have wrote an editorial of this problem on my blog.

Here is the editorial link

1 Like

can u pls explain the query part for a full block ??

how r u calculating the no.of numbers equal to x in a full block without actually traversing the entire block ?

can anyone explain where i am wrong solution link

I think its due to overflow…!

Try long long int once !!

no it doesn’t effect any

Hello, shahidul_brur I understood your editorial and tried to implement the solution. But I am getting WA on two test cases. Can you help me find out what is wrong.

Solution Link