I am getting "RE (SIGSEGV)" for the following line of code:
int dp[105][100005];
My laptop has 8GB of RAM. Is it not sufficient to store 10^7 integers?
I am getting "RE (SIGSEGV)" for the following line of code:
int dp[105][100005];
My laptop has 8GB of RAM. Is it not sufficient to store 10^7 integers?
It is if you dynamically allocate, as in:
int* dp = calloc(105 * 100005, sizeof(int));
Where you can use that 1D array in a 2D fashion via offset calculations.
You cannot fit something this big on the stack, it's just too huge. The stack is limited in size.