Casting unsigned int to signed int reduces stack memory usage, but why?

Правка en2, от accidentallygivenfuck, 2015-07-04 16:39:41

Today, I was checking the official solution for problem grassplant of USACO 2011 December Contest. I ran the solution on 12th test and it gave me runtime error (segmentation fault). I realized it was caused by stack overflow. Then (somewhy) I added (int) before E[u].size() in the function hang() and ran it on 12th test again. Surprisingly, stack did not overflow this time.

I tried doing it several times, and the code without (int) always run out of 8Mb of stack memory and the code with it used less than 8Mb of stack memory.

Can anyone who gets this stuff tell why this happens?

Теги stack memory, grassplant, usaco

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский accidentallygivenfuck 2015-07-04 16:39:41 159 Edit the post xD
en1 Английский accidentallygivenfuck 2015-07-04 16:34:02 611 Initial revision (published)