I am gettting wrong answer but sample test case is passed
My code is written here:-
Counting In Byteland
@Bhawna
Your loop should run till n rather than the max limit in the update function. Also during the query part , you should not update the x1,y1 and z1 coordinates.
Also during the update call for the increment as the new weight , not the difference.
Here , have a look at my code - https://ide.codingblocks.com/s/175785
I have made some changes in your code with comments.
Your working code -:
I got my mistake -I was updating difference.
My query function was correct and get AC,but I didn’t understand your Exclusion -Inclusion Formula .
Plz make me understand that " Exclusion -Inclusion Formula "
@Bhawna
We wish to obtain the volume of the cuboid whose corner points are (x2,y2,z2) and (x1,y1,z1) but there is no direct formula or function for this.
Our BIT gives the volume for any cuboid by fixing one corner point as (0,0,0) and the other corner point as the argument passed to it. So when we called for query(x2,y2,z2) , it returned us the volume for cuboid with corner points (x2,y2,z2) and (0,0,0) . We have to subtract the volumes of cuboids with the extra volume from it. In order to do , we subtract the volumes of other such cuboids as you can see in the formula. I cannot exactly explain all this as this requires more of a 3D imagination. Just take a good look at the formula and try to visualise it by plotting a graph maybe.
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.