I was solving this problem and submitted first and second. But It seems that the first code is getting RE on tc14 and the second one is getting accepted.
I am not sure why is this happening. The only difference in the two codes is first one has dp[maxn/2][maxn][maxm]
and second have dp[maxn][maxn/2][maxm]
.
Please help. Thanks.