Getting Wrong Answer on only edge cases in DP problem

Правка en1, от Darshann, 2021-06-13 13:33:03

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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Darshann 2021-06-13 13:33:03 643 Initial revision (published)