Getting wrong answer

I am solving this question… from codeforces… Based on dp…
This is the link of question…
https://codeforces.com/contest/1433/problem/F
This is my solution…


I want to know where my code logic is failing… What changes can i do…

hello @ashishnnnnn
pls explain which variable ur r using for what purpose

Actually… I found where i am doing wrong… If i can’t solve after this… Then i will reply with detail of variable… Otherwise i will mark this doubt solved :slight_smile: