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);//<<<
}
Amortized case means not all the test cases are big enough, some test cases are small and some are meet the constraints,
So if we calculate the overall computations of your code will be less than the worst case …