求助大佬,怎么一直报错?
  • 板块B3625 迷宫寻路
  • 楼主GANYUE
  • 当前回复4
  • 已保存回复4
  • 发布时间2023/12/24 20:40
  • 上次更新2023/12/24 23:49:31
查看原帖
求助大佬,怎么一直报错?
981804
GANYUE楼主2023/12/24 20:40

求助大佬,怎么一直报错呀?

辣祭代码:

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n, m;
LL dx[4] = {0, 0, 1, -1};
LL dy[4] = {1, -1, 0, 0};
string dps[114514];
bool ss[114514][114514];
void dfs(LL x, LL y)
{
	for(int i = 0; i < 4; i ++)
	{
		LL tx = 1;
		LL ty = 1;
		ss[x][y] = 1;
		if(tx >= 1 && tx <= n && ty >= 1 && ty <= m && dps[x + tx[i]][y + ty[i]] == '.' && ss[x + tx[i]][y + ty[i]] == 0)
		{
			dfs(x + tx[i],y + ty[i]);
		}
	}
	return ;
}
int main()
{
	cin >> n >> m;
	for(int  i = 1; i <= n; i ++)
	{
		for(int  j = 1; j <= m; j ++)
		{
			cin >> dps[i][j];
		}
	}
	dfs(1, 1);

    if(dps[n][m] == 1)  
	{
		cout << "Yes";
	}
    else 
	{
		cout << "No";
	}
    return 0;
}
2023/12/24 20:40
加载中...