StringGame(CWAR02) solution verification

I just coded this today…the problem seems interesting. But after writing it I observer that there is no way I can check this. You know how it feels when you code and cannot verify whether it is correct/wrong. That’s why I am posting my code here in hope that someone will check my code and tell me whether it is correct or incorrect.

The pastebin link-


Edit-1: The problem link - [PROBLEM][2]


Incorrect. Your code doesn’t even work for the given example. The simplest testcase for which it is producing wrong result is


Currently you are deciding whether to remove a A or a B by first trying A and if doesn’t work removing B. But you have to check both possibilities. If implemented efficiently this will work within the given constraints (use memoization!).

@ceilks.:Can you give me a hint about the dp state…btw why isn’t this in practice though it is saying so when opening the contest?