Could someone please tell me what's going wrong with this TABLESUM code? I am getting WA in all except 3 test cases. The algorithm is O(N), so time is not an issue. asked 06 Jan '15, 17:37

include<math.h>include<stdio.h>using namespace std; int a[200005],n,large[200005],front[200005]; int main() { //freopen("question.txt","r",stdin); cin>>n; int i,j,k; for(i=0;i<n;i++)cin>>a[i]; large[n1]=a[n1]+1; for(i=n2;i>=0;i)large[i]=max(large[i+1]+1,a[i]+1); //for(i=0;i<n;i++)cout<<large[i]<<" ";cout<<endl; front[0]=a[0]+1; for(i=1;i<n;i++)front[i]=max(front[i1],a[i]+i+1); //for(i=0;i<n;i++)cout<<front[i]<<" ";cout<<endl; cout<<front[n1]<<" "; for(i=1;i<n;i++) { j=front[n1i]+i;j=max(j,large[ni]); cout<<j<<" "; } } answered 28 Jan '15, 08:53

http://discuss.codechef.com/questions/60311/inoi2012problem2tablesum
I already saw that thread, in fact my solution is same as the O(N) solution in the Stack Overflow link, but yet my code yields WA. Thanks anyway
YEAH SOMEBODY PLEASE RESPOND ... I'm also having the same problem ... http://cpp.sh/2jym ... THANKS IN ADVANCE!!!