设为首页 加入收藏

TOP

HDU 1885 Key Task 状态压缩+搜索(二)
2015-07-20 17:56:28 来源: 作者: 【 】 浏览:7
Tags:HDU 1885 Key Task 状态 压缩 搜索
ode { int step,x,y,key; }; int bfs() { queue q; node now,next; now.x=s;now.y=t;now.step=now.key=0; vis[s][t][0]=true; q.push(now); while(!q.empty()) { now=q.front(); q.pop(); if(g[now.x][now.y]=='X')return now.step; for(int i=0;i<4;i++) { next.x=now.x+dir[i][0]; next.y=now.y+dir[i][1]; next.step=now.step+1; next.key=now.key; if(next.x<1||next.x>n||next.y<1||next.y>m||g[next.x][next.y]=='#')continue;//如果越界 if(g[next.x][next.y]>='A'&&g[next.x][next.y]<='Z'&&g[next.x][next.y]!='X') { for(int j=0;j<4;j++) if(g[next.x][next.y]==up[j]) { if(next.key&(1< ='a'&&g[next.x][next.y]<='z') { for(int j=0;j<4;j++) if(g[next.x][next.y]==low[j]) { if((next.key&(1<

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇HDU 4417 划分树+二分 下一篇POJ训练计划3277_City Horizon(扫..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: