The Cow Run

As always, here’s the prob statement: USACO

So I got close to solving this problem by myself, but I wasn’t able to account for how to consider the time that my current dp state ended at, since my dp state only stored the minimum total cost. So I looked at the internal solution for the problem on the USACO Guide, and I wasn’t able to completely understand the transitions. I understand which dp states were used in the transitions, but I wasn’t able to understand how the cost of the new cow to be added to a range was computed. Can someone help me figure out why these transitions work?

Here’s the analysis I was looking at btw: Solution - The Cow Run (Old Gold)

Please follow this: How to ask for help on a problem