I'm reading a dynamic programming algorithm to the weighted interval scheduling problem. There are $n$ intervals, each has a start time $s_i$, a finishing time $f_i$ and a value $v_i$. The goal is to find a subset of intervals with the maximum total of values. Let $p(j)=i$ be the left-most interval $i$ that finishes before interval $j$ begins.
Can you explain this reasoning:
"If interval $n$ (the last one) belongs to an optimal solution $O$, then $O$ must include an optimal solution to the problem consisting of intervals $\{1,...,p(n)\}$ -- for if it didn't, we could replace $O$'s choice of intervals from $\{1,...,p(n)\}$ with a better one, with no danger of overlapping n."
In particular, I don't understand how I can "replace the optimal solution with a better one". Thank you.
Below is the scanned copy of what I'm reading. My question is about the last sentence.