vector s; void split(int x,int y, int id = 1,int l = 0, int r = n){// id is the index of the node if(x >= r or l >= y) return ; // in this case, intersect of [l,r) and [x,y) is empty if(x <= l && r <= y){ s.push_back(id); return ; } int mid = (l+r)/2; split(x,y,id * 2,l,mid); split(x,y,id * 2 + 1,mid,r); }