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

Revision en1, by accidentallygivenfuck, 2015-07-04 16:34:02

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.

Can anyone who gets this stuff tell why this happens?

Tags stack memory, grassplant, usaco

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English accidentallygivenfuck 2015-07-04 16:39:41 159 Edit the post xD
en1 English accidentallygivenfuck 2015-07-04 16:34:02 611 Initial revision (published)