http://www.codechef.com/viewsolution/3934373
This solution takes 2.2M,
http://www.codechef.com/viewsolution/1647919
While this one only 1.6M .
Please explain this.
http://www.codechef.com/viewsolution/3934373
This solution takes 2.2M,
http://www.codechef.com/viewsolution/1647919
While this one only 1.6M .
Please explain this.
this is mainly due to different compiler versions…that submission was made using a previous version of C which has now been replaced with C 4.8.1 which you have used!!!
Here is how programs run on online judges:
Judge allocates a fixed minimum amount of memory X on the server to run your code
If memory consumed by code is <= X, then all is well
If more memory is needed, then extra memory is allocated by judge upto a certain limit L.
Currently L = 1.5 GB for the SPOJ judge on which codechef runs.
The value of X varies for each language. It was 1.6 M for old C compiler, 2.2 for new one, 2.8 for C++, around 4M for Python, 0.2 M for pascal and is around 1399M for Java. So the memory shown may or may not be the actual memory consumed depending on whether it exceeds the limit X or not.
http://discuss.codechef.com/questions/19189/update-of-gcc-to-481
As per this it takes 0.6M of extra memory…
Now check this it takes 2.6M
and now u r using a c++ compiler!!!
Okay, I see it now.
Thanks.
I understand it now.
Thanks.
In my first solution on this link, CodeChef: Practical coding for everyone I take a boolean array while in the rest two I have taken an integer array and still the memory consumption is same. Why? At one place I’m allocating 100000X1 bytes(for boolean) while in integer I’m allocating 4X(100000). That is the noticeable difference I suppose…