#include #include #include #include #include using namespace std; int O,M,N,N0,N1,C[50010],F[50010],R[50010]; bool B[50010]; struct node{ int s,t; }A[2][50010]; bool operator <(const node x,const node y){ return x.t>1; t[p]=node(build(l,mid),build(mid+1,r),0,0); update(p); return p; } void add(int p,int l,int r,int x,int y,int w){ if (x<=l&&r<=y){ t[p].add(w); return; } pushdown(p); int mid=(l+r)>>1; if (x<=mid){ add(t[p].l,l,mid,x,y,w); } if (mid