i did this problem http://www.codechef.com/problems/MARBLEGF using segmented tree concept…but i am getting tle…editorial say to use fenwick tree concept…But i came to know both fenwick tree and segmented tree have same time complexity in worst case which is O(mlogn)…anyone clear my doubt plsss…thanks in advance:)

this is my code which uses the concept of segment tree http://www.codechef.com/viewsolution/3436231