C++ Stack Limit in Codeforces

Правка en1, от 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?

Теги #stack, #memory, #limit, #codeforces

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский brdy 2018-01-05 00:30:53 629 Initial revision (published)