How I have improved in CP

I want to take a second and look back on my CP journey, getting better at problem solving.

There are many problems that I was not able to solve at the time, that now I am able to solve.

YAC3

At the time, I got 20 points, and 30 points on the problems.

Consider this problem:

My submissions: https://dmoj.ca/problem/yac3p1/submissions/Gongsta/

At the time, my idea was to treat the problem as a graph.

Now, I was able to see ideas that I wasn’t able to see at the time. Notably, there is only a single shell that is moving at all times. That means that I can process it from the left, and process it right the right independently, using some sort of 2 pointer idea.

Then, make the observation about -1. What swaps do we do? A single -1 or more allows us to move the shell from the start to the end position.