第十届蓝桥杯迷宫代码运行后没有结果,检查了好多遍还是找不到问题所在

问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果
#include<iostream>
#include<cstring>
#include<queue>
#include<string>
#include<cstdio>
using namespace std;
char map[500][500];
int vis[500][500];
int dir[4][2]={
  {1,0},
  {0,-1},
  {0,1},
  {-1,0}
};
char dic[4]={'D','L','R','U'};
struct point{
    int x,y;
    int step;
    string road;
};
int x1,y1,x2,y2,m,n;
void bfs(){
    queue<point> r;
    point start;
    start.x=x1;
    start.y=y1;
    start.step=0;
    start.road="";
    vis[x1][x2]=1;
    r.push(start);
    while(!r.empty()){
        point temp;
        temp=r.front();
        if(temp.x==x2&&temp.y==y2){
            cout<<temp.step<<endl<<temp.road;
        }
        point now;
        for(int i=0;i<4;i++){
            now.x=temp.x+dir[i][0];
            now.y=temp.y+dir[i][1];
            if(now.x>=0&&now.x<n&&now.y>=0&&now.y<m&&vis[now.x][now.y]==0&&map[now.x][now.y]!='1'){
                vis[now.x][now.y]=1;
                now.step=temp.step+1;
                now.road=temp.road+dic[i];
                r.push(now);
            }
        }
        r.pop();
    }
}
int main(){
    n=30,m=50;
    int i,j;
    memset(map,'1',sizeof(map));
    memset(vis,0,sizeof(vis));
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            cin>>map[i][j];
        }
    }
    x1=0,y1=0;
    x2=n-1,y2=m-1;
    bfs();
    return 0;
} 

题目是啥??