Can anyone explain me the approach to solve this problem? I am unable to understand the codeforces editorial.
It’s not a dp.
Thanks a lot . You made my day @everule1