90分求助大佬,第一个点WA了

P2298 Mzc和男家丁的游戏

主页双贴,危
by 小糯米 @ 2022-01-03 16:08:46


@[小糯米](/user/152341) ?
by yqnyyh @ 2022-01-03 16:12:50


已AC,谢谢。
by yqnyyh @ 2022-01-04 10:46:40


```cpp #include <bits/stdc++.h> using namespace std; int n,m,vis[3000][3000]; int dx[4]={1,-1,0,0}; int dy[4]={0,0,1,-1}; char mapp[3000][3000]; struct data { int x,y; }; queue<data>q; int main() { cin>>n>>m; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { vis[i][j]=-1; cin>>mapp[i][j]; if(mapp[i][j]=='m') { data start; start.x=i; start.y=j; q.push(start); vis[i][j]=0; } } } while(q.empty()==0) { data start=q.front(); for(int i=0;i<4;i++) { data now; now.x=start.x+dx[i]; now.y=start.y+dy[i]; if(now.x>n||now.y>m||now.x<1||now.y<1) continue; if(vis[now.x][now.y]==-1&&mapp[now.x][now.y]!='#') { vis[now.x][now.y]=vis[start.x][start.y]+1; q.push(now); } if(mapp[now.x][now.y]=='d') { cout<<vis[now.x][now.y]<<endl; return 0; } } q.pop(); } cout<<"No Way!"<<endl; return 0; } ```
by yqnyyh @ 2022-01-04 10:48:06


yqn酱 我可以偷走你的代码嘛
by SafeGlobefish @ 2022-01-08 19:51:26


|