Why segment tree failed for "Counting In Byteland"?

bit
complexity
hackerearth
segment-tree
time-limit

#1

Hi,

This is the problem Counting In Byteland

Segment Tree Solution

BIT Solution

I did this question using segment tree during the contest, got TLE.

I got this idea from here.

I guess my solution have following time and Space complexity:

     update : (logN)^3
     query :  (logN)^3
     space : 8*(8^log8(N))-1  

Reference

According to the solution, the author gave 3-D BIT solution.

What is complexity of segment tree of update and query?