Getting Wrong Answer on only edge cases in DP problem

Revision en1, by Darshann, 2021-06-13 13:33:03

https://codeforces.net/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?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Darshann 2021-06-13 13:33:03 643 Initial revision (published)