I was solving a question on codechef. My approach was as follows -
First built each array height with the help of segment tree (Lazy Propagation) and find the index of the array having height k(store it in Vector C) and k+1(store it inVector B). //up to 99
Then after found the number of element b/w each range in C and B.Let it is a & b respectively.
Initially, the answer for removing ith operation will be the size of C and after removing that operation the answer will ans=C.size() +b-a.
It is giving the correct answer for 1 test case but wrong for more test cases.
So I added a line 62(T[node]=0) to initialize it each time but now it is giving TLE.
I am not getting it why it is giving TLE.
My code is https://ideone.com/QUz7HY