I just found strange thing about sprintf()
(c++ library function).
have a look at these two solutions
[Time limit Exceeded solution][1]
[Accepted Solution][2]
the only difference between them is that, I used
sprintf(a,"%d%c",n,'\0');
in TLE solution,
in AC solution I replaced above sprintf()
with
sprintf(a,"%d",n);
You can also observe that ACed solution took only 0.01s and 2.8MB memory
but TLE solution took around 11.8MB
[check here][3]
And one more thing program that gave TLE runs in 0s in [IDEONE][4] with extreme input data
so is it a bug in [CODECHEF][5] itself
Somebody please explain me is this a bug or some considerable unknown operation is happening here.
Thanks in advance.
[5]: http://www.codechef.com
[4]: http://ideone.com/e.js/jMhUVJ
[3]: http://www.codechef.com/status/FCTRL2?sort_by=All&sorting_order=asc&language=All&status=All&handle=hkbharath&Submit=GO
[2]: http://www.codechef.com/viewsolution/3938145
[1]: http://www.codechef.com/viewsolution/3938157