Three things to remember:
Add dimensions when one index can't describe the situation. Here, level number alone wasn't enough. You also needed to track red blocks used.
The transition updates multiple indices. Going from level to changed both the level AND potentially the red count.
The answer might be a sum over states. Not just one cell, but all valid cells where constraints are satisfied. The four-step pattern worked exactly the same. You just had more bookkeeping.