您当前的位置: 首页 > 

钟钟终

暂无认证

  • 5浏览

    0关注

    232博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

4/6 深搜、广搜专题+二分答案+单调队列

钟钟终 发布时间:2022-04-06 23:09:56 ,浏览量:5

经典迷宫问题: P6207 [USACO06OCT] Cows on Skates G 1.广搜可用于查找最少需要的步数,而深搜可求出到达终点的路经数。 2.可开一个数组记录路径,最后用深搜回溯路径。注意起点和终点的设置,可能需要自行补上。

#include
#define int long long
using namespace std;
int r,c,way[155][155][2];
int dx[4]={-1,1,0,0};
int dy[4]={0,0,1,-1};
char mp[155][155];
bool vis[155][155];
struct node
{
    int x,y,s;
};
queueq;
void dfs(int xx,int yy)
{
    if(!way[xx][yy][0]&&!way[xx][yy][1]) return;
    dfs(way[xx][yy][0],way[xx][yy][1]);
    cout            
关注
打赏
1664378814
查看更多评论
0.0516s