MyVector<int> GetBreakpoints(int k, int n, int** M) { MyVector<int> TheBreakpoints; if (k>1) { int Prec = M[k-1][n-1]; TheBreakpoints.push_back(Prec+1); if (k>2) for (int i=(k-2); i>=1; i--) { TheBreakpoints.push_back(M[i][Prec]+1); Prec = M[i][Prec]; } } TheBreakpoints.push_back(0); TheBreakpoints.reverse(); TheBreakpoints.push_back(n); TheBreakpoints.sort(); return TheBreakpoints; }