Challenges : Fenwick Tree, 3-D structure

Why is it not working correctly? Also, is there any other way to solve this question efficiently?

hello @deep4013

the update function for 3d fenwick tree is bit different from 1d .

pls refer this->link

I got the update and f function in the problem setter code but what is the solve function doing? Also, what does this 3-D array store then as there are multiple additions and subtractions?

its a inclusion exlusion formula .
first refer this 2d bit to understand what actually inclusion exclusion->link

Ok got it . Thanks!. Close this doubt too.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.