Codeforces 381E Sereja and Brackets(线段树)
http://codeforces.com/contest/381/problem/E Sereja and BracketsSereja has a bracket sequence s1, s2, …, sn, or, in other words, a string s of length n, consisting of characters “(” and “)”