memory limit on c/c++ program

I wanna know that how to declare an array of more than 10^7 … C/C++ only allows to declare array of 10^7 … what if i want to declare array of more than 10^7… anyone please help …

Try declaring them globally. Or use runtime memory allocation. Declaring very large arrays locally will not help.

AFAIK, a total of 256 MB is guaranteed, and you might even get more!!

Experimental answer on DIVQUERY in practice mode: ~1500MB is acceptable, not more. I’d still prefer to see that documented in FAQ.

This submission throws SIGABRT and this does not.

1 Like

Memory limit represent total amount of memory will be required to run the program on a server. For example: If Memory limit is provided in a question is 512 MB then it will include your total Auxiliary space + total stack size(during recursion).

To know more about stack size. Refer this two links:

you can use static or global array to get 10^8 or use vector to get allocation of more than 10^9elements

even global arrays cannot be declared more than 10^8 … any other way

New contests run on Cube - so your experimental answer is really good :wink: