I was trying solving the problem George and job of contest 467C. And my solution is : 2cC2Fb - Online C++ Compiler & Debugging Tool - Ideone.com I am using dp and finding out dp[k][i] i.e. the maximum sum of k subsets of the size m from 1 to i in the given array input. Thus, that sum is computed as :

```
dp[k][j]= max(dp[k-1][j-size]+sum[j],dp[k][j-1]);
```

I.e for a given K, i’ll get the maximum of the addition of sum (k-1) subset which ends at j-size, size here is `m +sum[j`

] which is basically the subset `[j-size,j]`

. Either I am including this or I am not including thi, the deciding factor is the maximum sum. I am getting WA on 22nd test case. I thought it’s exceeding the range, and so made it unsigned long long int also, but then it gives Memory limit exceeded. I went across one of the solution, I only saw the memory used by the arrays and it was the same as of my code. Then, why such error?