https://mirror.codeforces.com/contest/118/problem/D
My code: https://pastebin.com/XbyR6Das
I am getting the correct answer for almost all test cases but it's failing for larger test cases. Can someone explain why this is happening? Also, there is some weird behaviour I'm noticing when I run this code on my machine in sublime text. For larger testcases (when n1
==100 or n2
==100), the output is changing if I increase the size of dp
array from dp[101][2][11][101]
to dp[101][3][11][101]
. Is this because I am using excess memory or is there some other reason?