I think it should be O(n*logn), but it seems it’s more then that…
//bo is a string consisting of '0's and '1's
for(int i=0;i<n;i++){
int from=i,to=i;
while(bo[i]=='1'){
to++;
i++;//<<<
}
sort(v.begin()+from,v.begin()+to+1);//<<<
}