[My Code][1] http://www.codechef.com/viewsolution/3971016
Please Help!
Observe this declaration :
int num[101];
and this usage :
num[temp]++;
As temp could be as high as 10000 (1 <= A[i] <= 10000)
So when you try to do num[temp]++, where temp >= 102 you can get segmentation fault (SIGSEGV) since you have declared only 101 elements. Try changing 101 to 10001 and so you can solve this,also remember to change at these “for” loops too :
for(i=0;i<101;i++)
and
for(i=2;i<101;i++)