0_0_20612287_31129.cpp:6:5: error: 'q' does not name a type
q; node now,next; memset(dis,0,sizeof(dis)); memset(flag,0,sizeof(flag)); int i,l; for(i=0;i<n;i++) { scanf("%s",map[i]); for(l=0;l<m;l++) { if(map[i][l]=='1') { now.x=i,now.y=l; q.push(now); flag[i][l]=1; } } } while(!q.empty()) { now=q.front(); q.pop(); for(i=0;i<4;i++) { next.x=now.x+dir[i][0]; next.y=now.y+dir[i][1]; if(next.x<0 || next.x>=n || next.y<0 || next.y>=m) continue; if(flag[next.x][next.y]) continue; q.push(next); flag[next.x][next.y]=1; dis[next.x][next.y]=dis[now.x][now.y]+1; } }}int main(){ int i,l; while(scanf("%d%d",&n,&m)!=-1) { solve(); for(i=0;i<n;i++) { printf("%d",dis[i][0]); for(l=1;l<m;l++) printf(" %d",dis[i][l]); printf("\n"); } } return 0;}
^
0_0_20612287_31129.cpp:6:11: error: 'node' does not name a type
q; node now,next; memset(dis,0,sizeof(dis)); memset(flag,0,sizeof(flag)); int i,l; for(i=0;i<n;i++) { scanf("%s",map[i]); for(l=0;l<m;l++) { if(map[i][l]=='1') { now.x=i,now.y=l; q.push(now); flag[i][l]=1; } } } while(!q.empty()) { now=q.front(); q.pop(); for(i=0;i<4;i++) { next.x=now.x+dir[i][0]; next.y=now.y+dir[i][1]; if(next.x<0 || next.x>=n || next.y<0 || next.y>=m) continue; if(flag[next.x][next.y]) continue; q.push(next); flag[next.x][next.y]=1; dis[next.x][next.y]=dis[now.x][now.y]+1; } }}int main(){ int i,l; while(scanf("%d%d",&n,&m)!=-1) { solve(); for(i=0;i<n;i++) { printf("%d",dis[i][0]); for(l=1;l<m;l++) printf(" %d",dis[i][l]); printf("\n"); } } return 0;}
^
0_0_20612287_31129.cpp:6:35: error: expected constructor, destructor, or type conversion before '(' token
q; node now,next; memset(dis,0,sizeof(dis)); memset(flag,0,sizeof(flag)); int i,l; for(i=0;i<n;i++) { scanf("%s",map[i]); for(l=0;l<m;l++) { if(map[i][l]=='1') { now.x=i,now.y=l; q.push(now); flag[i][l]=1; } } } while(!q.empty()) { now=q.front(); q.pop(); for(i=0;i<4;i++) { next.x=now.x+dir[i][0]; next.y=now.y+dir[i][1]; if(next.x<0 || next.x>=n || next.y<0 || next.y>=m) continue; if(flag[next.x][next.y]) continue; q.push(next); flag[next.x][next.y]=1; dis[next.x][next.y]=dis[now.x][now.y]+1; } }}int main(){ int i,l; while(scanf("%d%d",&n,&m)!=-1) { solve(); for(i=0;i<n;i++) { printf("%d",dis[i][0]); for(l=1;l<m;l++) printf(" %d",dis[i][l]); printf("\n"); } } return 0;}
^
0_0_20612287_31129.cpp:6:65: error: expected constructor, destructor, or type conversion before '(' token
q; node now,next; memset(dis,0,sizeof(dis)); memset(flag,0,sizeof(flag)); int i,l; for(i=0;i<n;i++) { scanf("%s",map[i]); for(l=0;l<m;l++) { if(map[i][l]=='1') { now.x=i,now.y=l; q.push(now); flag[i][l]=1; } } } while(!q.empty()) { now=q.front(); q.pop(); for(i=0;i<4;i++) { next.x=now.x+dir[i][0]; next.y=now.y+dir[i][1]; if(next.x<0 || next.x>=n || next.y<0 || next.y>=m) continue; if(flag[next.x][next.y]) continue; q.push(next); flag[next.x][next.y]=1; dis[next.x][next.y]=dis[now.x][now.y]+1; } }}int main(){ int i,l; while(scanf("%d%d",&n,&m)!=-1) { solve(); for(i=0;i<n;i++) { printf("%d",dis[i][0]); for(l=1;l<m;l++) printf(" %d",dis[i][l]); printf("\n"); } } return 0;}
^
0_0_20612287_31129.cpp:6:103: error: expected unqualified-id before 'for'
q; node now,next; memset(dis,0,sizeof(dis)); memset(flag,0,sizeof(flag)); int i,l; for(i=0;i<n;i++) { scanf("%s",map[i]); for(l=0;l<m;l++) { if(map[i][l]=='1') { now.x=i,now.y=l; q.push(now); flag[i][l]=1; } } } while(!q.empty()) { now=q.front(); q.pop(); for(i=0;i<4;i++) { next.x=now.x+dir[i][0]; next.y=now.y+dir[i][1]; if(next.x<0 || next.x>=n || next.y<0 || next.y>=m) continue; if(flag[next.x][next.y]) continue; q.push(next); flag[next.x][next.y]=1; dis[next.x][next.y]=dis[now.x][now.y]+1; } }}int main(){ int i,l; while(scanf("%d%d",&n,&m)!=-1) { solve(); for(i=0;i<n;i++) { printf("%d",dis[i][0]); for(l=1;l<m;l++) printf(" %d",dis[i][l]); printf("\n"); } } return 0;}
^
0_0_20612287_31129.cpp:6:111: error: 'i' does not name a type
q; node now,next; memset(dis,0,sizeof(dis)); memset(flag,0,sizeof(flag)); int i,l; for(i=0;i<n;i++) { scanf("%s",map[i]); for(l=0;l<m;l++) { if(map[i][l]=='1') { now.x=i,now.y=l; q.push(now); flag[i][l]=1; } } } while(!q.empty()) { now=q.front(); q.pop(); for(i=0;i<4;i++) { next.x=now.x+dir[i][0]; next.y=now.y+dir[i][1]; if(next.x<0 || next.x>=n || next.y<0 || next.y>=m) continue; if(flag[next.x][next.y]) continue; q.push(next); flag[next.x][next.y]=1; dis[next.x][next.y]=dis[now.x][now.y]+1; } }}int main(){ int i,l; while(scanf("%d%d",&n,&m)!=-1) { solve(); for(i=0;i<n;i++) { printf("%d",dis[i][0]); for(l=1;l<m;l++) printf(" %d",dis[i][l]); printf("\n"); } } return 0;}
^
0_0_20612287_31129.cpp:6:115: error: 'i' does not name a type
q; node now,next; memset(dis,0,sizeof(dis)); memset(flag,0,sizeof(flag)); int i,l; for(i=0;i<n;i++) { scanf("%s",map[i]); for(l=0;l<m;l++) { if(map[i][l]=='1') { now.x=i,now.y=l; q.push(now); flag[i][l]=1; } } } while(!q.empty()) { now=q.front(); q.pop(); for(i=0;i<4;i++) { next.x=now.x+dir[i][0]; next.y=now.y+dir[i][1]; if(next.x<0 || next.x>=n || next.y<0 || next.y>=m) continue; if(flag[next.x][next.y]) continue; q.push(next); flag[next.x][next.y]=1; dis[next.x][next.y]=dis[now.x][now.y]+1; } }}int main(){ int i,l; while(scanf("%d%d",&n,&m)!=-1) { solve(); for(i=0;i<n;i++) { printf("%d",dis[i][0]); for(l=1;l<m;l++) printf(" %d",dis[i][l]); printf("\n"); } } return 0;}
^
0_0_20612287_31129.cpp:6:347: error: expected unqualified-id before 'while'
q; node now,next; memset(dis,0,sizeof(dis)); memset(flag,0,sizeof(flag)); int i,l; for(i=0;i<n;i++) { scanf("%s",map[i]); for(l=0;l<m;l++) { if(map[i][l]=='1') { now.x=i,now.y=l; q.push(now); flag[i][l]=1; } } } while(!q.empty()) { now=q.front(); q.pop(); for(i=0;i<4;i++) { next.x=now.x+dir[i][0]; next.y=now.y+dir[i][1]; if(next.x<0 || next.x>=n || next.y<0 || next.y>=m) continue; if(flag[next.x][next.y]) continue; q.push(next); flag[next.x][next.y]=1; dis[next.x][next.y]=dis[now.x][now.y]+1; } }}int main(){ int i,l; while(scanf("%d%d",&n,&m)!=-1) { solve(); for(i=0;i<n;i++) { printf("%d",dis[i][0]); for(l=1;l<m;l++) printf(" %d",dis[i][l]); printf("\n"); } } return 0;}
^
|