Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

C++ Stack Limit in Codeforces

Revision en1, by brdy, 2018-01-05 00:30:53

According to a comment by ffao, Codeforces reserves 256MB to stack size by default.

However, my solution that does not exceed 1e7 layers of recursion in this sample 33910932, yet it RTE's because of too deep recursion. (I had to write iterative solution to get AC)

Supposing each 64 bit int uses 8 bytes, and a pointer in a 64-bit compiler would take 8 bytes. 1e7 * 16 bytes = 160 megabytes.

Is there extra memory usage I am unaware about? Shouldn't this be able to squeeze under the size limit?

Tags #stack, #memory, #limit, #codeforces

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English brdy 2018-01-05 00:30:53 629 Initial revision (published)