In the AtCoder Beginner Contest 271, I made two submissions for Problem D.
Submission 1, which is an AC.
Submission 2, which is a WA.
In Submission 1, I declared dp as
int dp; globally, and used
memset(dp, -1, sizeof(dp)); inside main function. In Submission 2, I declared dp as
vector<vector<int>> dp(101, vector<int>(10001, -1)); inside main function, and passed it in function 'f' by reference.
I'm clueless about what is causing this WA in Submission 2, when the logic remains same. Could someone please help me with this.