Bug:UVA816

东西南北 对应行进加减1容易反

const char* DIR="EWSN",TURN="FLR";

const int dx\[\]={1,-1,0,0},dy\[\]={0,0,-1,1};

当路线会回到出发点的时候,有很多 corner cases 起先没想到

复制代码
void solve(){
    queue<node> q;
    memset(d,-1,sizeof(d));
    node n1(r1,c1,dir);
    q.push(n1);
    d[r1][c1][dir]=0;
    while (!q.empty()){
        node u=q.front();
        q.pop();
        if (u.r==r2 && u.c==c2){
            print_ans(u);
            return;
        }
        _for(i,0,2){
            node v=walk(u,i);
            if (has_edge[u.r][u.c][u.dir][i] && in(v.r,v.c) && d[v.r][v.c][v.dir]<0){
                d[v.r][v.c][v.dir]=d[u.r][u.c][u.dir]+1;
                p[v.r][v.c][v.dir]=u;
                q.push(v);
            }
        }
    }
    cout<<maze_name<<'\n';
    cout<<"  No Solution Possible"<<'\n';
}

也就是说dr0c0?在开始并不统计

vector打印代替DFS避免栈溢出

相关推荐
2601_967987372 天前
程序员遇到BUG的解释
程序员·bug·软件开发·调试·幽默
jianqiang.xue2 天前
线程一切换浮点全作废:五天修好的隐秘bug
bug
寂寞的船5 天前
【Unity Bug挑战】第12期 Awaitable 二次 await 死锁之谜 —— 为什么同一个异步操作等两次就卡死?
unity·c#·游戏引擎·bug
海拥✘6 天前
让 AI 修 AI 平台自己的 Bug:我用 SoduWork 给 SoduWork 提了一个 PR
人工智能·bug
Risehuxyc8 天前
fix bug
bug
拖累斯11 天前
Jenkins + Python 全自动跑通「禅道任务/BUG 导出 → 月度开发考核表」
python·jenkins·bug
寂寞的船11 天前
【Unity Bug挑战】第10期 SerializeReference 内存泄漏之谜
unity·c#·游戏引擎·bug
unity工具人12 天前
unity 照片墙插件(Pop-up Photo Wall)在触摸屏和红外框设备上的触发Bug
bug
灼行15 天前
Autosar SecOC 需求场景BUG(需求不一致性)【草稿】
bug
小豆庄17 天前
视频遮罩追踪退场后ID撞号的排查—多目标场景下的失效
opencv·算法·bug·视频·python3.11