Hi, I have tried solving spoj.pl/problems/BANDW/, which looks easy to me. But I am getting segmentation fault. what can be the issue??.. I tried increasing size of the array(500 as max length given in problem to 1000000) which might oveflow.
Here is the code
removed after AC
Got the issue. It is accepted now
Problem was at
#define FOR1(i,a,b) for(int i=(a);i<(b);++i) FOR1(i,0,len) if(arr[i]==0){ res++; while(arr[i]==0) ++i; // here arr[i] was overshooting the array size. though not happening on local compiler --i; }