https://codeforces.me/contest/1906/problem/E
This is the link to the problem E of 2023-2024 ICPC, Asia Jakarta Regional Contest (Online Mirror, Unrated, ICPC Rules, Teams Preferred) , can anyone help me in understanding the intuition and logic behind the dp approach of this problem. I cannot seem to grasp the logic behind the problem.
Any suggestion/idea maybe helpful too!!