problem link:- https://www.spoj.com/problems/BRCKTS/
solution link:- https://ideone.com/BDI8kg
I have used iterative segment tree to solve problem. I have tested it on several test cases but don’t know why getting wrong answer.
Try this
28 ())(())()(()())(()(()())(()) 5 0 3 0 25 0
I think the output should be
NO NO YES