萌新求助

P1457 [USACO2.1] 城堡 The Castle

主要是 ```cpp while(q.empty()==false){ cur=q.front(); q.pop(); for(int i=0;i<4;i++){ int xx=x+fx[i]; int yy=y+fy[i]; cout<<a[cur.x][cur.y][i]; if(xx>=1&&yy>=1&&xx<=m&&yy<=n&&pop[xx][yy]==0&&!a[cur.x][cur.y][i]){ node next; next.x=xx; next.y=yy; he++; pop[xx][yy]=1; q.push(next); } } } ``` 这一段,标记时会穿墙
by _maze @ 2019-06-23 20:33:14


@[c_x_c](/space/show?uid=149219) 首先 ```cpp int xx=x+fx[i]; int yy=y+fy[i]; ``` 这里x,y应为cur.x,cur.y; 其次读入时n,m应该换一下
by ljk123 @ 2019-06-23 22:08:44


谢谢!@[ljk123](/space/show?uid=44180)
by _maze @ 2019-06-24 14:40:36


|