Comments

In E, I'm getting MLE if I put prefix array in the heap memory, but the solution passing when I put the prefix array as a global array. Why is that so?

170374285

int main() {
    ll** pt = new ll*[1001];
    ll** dp = new ll*[1001];
    for(int i=0;i<=N;i++){
	pt[i] = new ll[1001];
	dp[i] = new ll[1001];
    }
   //......
}

vs

170372939

ll pt[1001][1001];
ll dp[1001][1001];
int main(){
   //.....
}