Hi,
I'm trying out problem 189A (https://codeforces.me/problemset/problem/189/A). I wrote simple DP (memoization) solution. Upon submission it's giving WA for test case 7
Input
10 3 4 5
Output
275861439
Answer
3
Checker Log
wrong answer 1st words differ - expected: '3', found: '275861439'
Here's my latest submission for the code (the one giving WA): https://codeforces.me/problemset/submission/189/221916967
When I run my code locally with the same failing test case, I get the correct answer. It happened one time before with test case 1 also. Locally, I got correct result, but on submission, it failed. Upon resubmitting with slight change in code (added reference operator '&' in parameter of recursive function, didn't changed the logic), the test case passed and now failing at test case 7.
Pls help in understanding why is this happening, so that I can avoid the mistake (if any) moving further.