文章
85
粉丝
0
获赞
315
访问
6.1k
#include <bits/stdc++.h>
using namespace std;
#define Max 35
char mymap [Max][Max];
int is_visited[Max][Max];
int dir[4][2]={{0,1},{-1,0},{0,-1},{1,0}};
struct node {
int x,y;
int time;
};
void dfs (int x,int y,int t,int n,int m) {
memset(is_visited,0,sizeof(is_visited));
queue<node> q;
q.push({x,y,0});
is_visited[x][y]=1;
while (!q.empty()) {
node temp = q.front();
q.pop();
if (temp.time==t) {
continue;
}
for (int i=0;i<4;i++) {
int newx = temp.x + dir[i][0];
int newy = temp.y + dir[i][1];
if (newx<0 || newx>=n || newy<0 || newy>...
登录后发布评论
暂无评论,来抢沙发