|
|
back to boardSeriously!!!!!Why WA?? int main() { optimize(); int n,k; cin>>n>>k; k--; int z=k; bool b=0; int a[n+10]; for(int i=0;i<n;i++) { if(k!=0) { if(b==0) { a[i]=k; b=1; z--; } else { if(z==0) { a[i]=0; k=0; b=1; continue; } a[i]=-k; k--; b=0; z--; if(z==0) k=0; } } else a[i]=0; //dbg(z); } for(int i=n-1;i>=0;i--) cout<<a[i]<<" "; //return main(); } when going to print 0 0 -3 3 or -3 3 0 0 I am getting WA..But When I print 0 0 -1 1 I get AC..Why?what is the difference between 1st two case and last one??Can anyone explain me?? |
|
|