explaination needed Maxpr !!

dynamic-programming
maxpr

#1

PROBLEM : MAXPR

I tried it using the editorial’s method but getting TLE…

And also the tester’s & setter’s solution uses some other method… No explaination for this method is given in editorial…

I want to know how does below algo works ? what does cnt[][] stands for? reply asap

tester’s solution :TESTER’S sol

   ans = n + 1;
   for(i =0;i<n;i++){
    scanf("%d",&x);
    AIN(1,x,100);
    for(j = 0;j<=100;j++){
        cnt[x][x-j+100]+=cnt[j][x - j+100];
        cnt[x][x-j+100]%=MOD;
    }
    for(j = -100;j<=100;j++){
        cnt[x][j + 100]++;
        cnt[x][j+100]%=MOD;
        ans --;
    }
}

#2

anyone ???