Problem Link : https://atcoder.jp/contests/dp/tasks/dp_p
My Solution Link before dp : https://ide.codingblocks.com/s/345205
My Solution Link After Applying Dp :
My code before applying dp is passing on 11 test cases but after applying dp it is only passing in two test cases please let me know the reason why.
Both the codes are not getting accepted on atcoder please help me so that the codes get accepted on atcoder.