I am trying to solve Sereja and Brackets . I can see that n is up to 10^6. And I have seen others solutions and they are pretty much as same as mine. I cannot figure out why I am getting TLE for my submission. Cannot find anything wrong with my segment tree or if I have missed something. :(
This is my submission. 37125846