求助qwq为什么会只有70呀orz

P2161 [SHOI2009] 会场预约

同问 ``` #include<iostream> using namespace std; const int M=100010; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 int c[M<<2]; bool del[M],ns[M<<2]; int ansa,ansb,cnt; int n,st,ed; char ch; void push_down(int rt) { ns[rt]=1; if(c[rt]) { c[rt<<1]=c[rt<<1|1]=c[rt]; c[rt]=0; } } void work(int x,int l,int r,int rt) { if(!ns[rt]) { if(c[rt]&&!del[c[rt]])ansa++,ansb--,del[c[rt]]=1; c[rt]=x; return; } c[rt]=x;ns[rt]=0; int mid=(l+r)>>1; work(x,lson);work(x,rson); } void update(int L,int R,int x,int l,int r,int rt) { if(L<=l&&r<=R) { work(x,l,r,rt); return; } push_down(rt); int mid=(l+r)>>1; if(mid>=L)update(L,R,x,lson); if(R>mid)update(L,R,x,rson); } int main() { ios::sync_with_stdio(false); cin>>n; int i; for(i=1;i<=n;i++) { cin>>ch; if(ch=='A') ansa=0, ansb++, cin>>st>>ed, update(st,ed,++cnt,1,M,1), cout<<ansa<<endl; else cout<<ansb<<endl; } return 0; } ```
by a___ @ 2018-09-05 22:39:19


|