First of all it returns wrong result for number 9 - it returns ‘:’.
NZEC is probably because your a is of length 1.000.000, and there is no space for input 1.000.000 x ‘9’ I guess.
Thanks for your reply.
How do I store those large numbers then?
Your approach seems ok to me, just resize the array from 1.000.000 to let say 1.000.010 and try to submit it again. It’s a good habit to use slightly bigger arrays in contest programming.
I tried that… but still not working me!
I do not see your submit, how did you try it?
I submitted the code on SPOJ. Wait I’ll submit it here.
I resized the array to 1000010.
I checked your code once again…why your left and right arrays are of length 5000? for 16000x ‘9’ it returns SEGFAULT - http://ideone.com/iJlcui you didn’t try the input I suggested before…
Thanks! I didn’t see that.
I am stuck with wrong answer now
for example for 998 it returns 1001, but correct is 999