|
|
back to boardWhat's wrong? Posted by Uran 16 Apr 2007 17:28 Is 1000000 of int is too much? I think it is about of 4 megabytes of RAM. If c=1000 its crashes. Why? Code is here: #include <iostream.h> #include <iostream> const long c=1001; int main() { // freopen("input.txt","rw",stdin); char ch; long i,j,n,fl,fl1,fl2,a[c][c],p1[c],q1[c],p2[c],q2[c]; i=j=n=fl=fl1=fl2=0; cin>>n; for (i=1;i<n+1;i++) for (j=1;j<n+1;j++) {cin.get(ch); if ((ch=='0')||(ch=='1')){a[i][j]=ch-'0';} else j--;} for (i=1;i<n+1;i++) { fl=0; for (j=1;j<n+1;j++) if (a[i][j]==0) fl=1; if (fl==1) q1[i]=0; else q1[i]=1; fl=0; for (j=1;j<n+1;j++) if (a[j][i]==0) fl=1; if (fl==1) q2[i]=0; else q2[i]=1; } for (i=1;i<n+1;i++){p1[i]=a[i][1];} for (i=1;i<n+1;i++){p2[i]=a[1][i];} fl1=1;fl2=1; for (i=1;i<n+1;i++) if ((q1[i]==0)&(p1[i]==1)) fl1=0; for (i=1;i<n+1;i++) if ((q2[i]==0)&(p2[i]==1)) fl2=0; fl=fl1||fl2; if (fl==0) cout<<"No"; else cout<<"Yes"; return 0; }please help me its bad idea Posted by Uran 17 Apr 2007 21:16 I found better idea. And if You want to fix bug like in my program link more stack in your memory. |
|
|