Codeforces Round #603 (Div. 2) E. Editor (线段树维护全局最值)
题目链接#includeconstintmaxn=1e6+5;intsum[maxn>1;if(pos1)--x;}elseif(s[i]=='R')++x;elseif(s[i]=='(')update(1,1,n,x,1);elseif(s[i]==')')update(1,1,n,x,-1);elseupdate(1,1,n,x,0);if(mi[1]<0||sum[1]!=0)printf