Hi!! Below is my submission to Atcode 373 question F Question link -> https://atcoder.jp/contests/abc373/tasks/abc373_f
Submission link -> https://atcoder.jp/contests/abc373/submissions/58252175
I have understood the basic dp state transitions and implemented it. However there is some sort of optimization which i am not really able to understand from the editorial.
It would be nice if someone could explain the optimization in a bit understandable way. Thanks!!!