I was trying to solve CHEFFA from August long. My thinking was same as others used, using table dp[index][x][y], but my code is not only failing on test cases, but also giving TLE. Similar codes have got a AC, so I am guessing I am at fault in implementation.
I will be really grateful if someone can point out my mistake, so that I can know where I erred. My code link-