HDU 4634 Swipe Bo (BFS+状压)

本文介绍了如何解决HDU 4634题目‘Swipe Bo’,重点探讨了使用宽度优先搜索(BFS)结合状态压缩(位运算)的解题策略。
摘要由CSDN通过智能技术生成

哎,学到了~!@~!@

//#pragma comment(linker, "/STACK:102400000,102400000")
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
using namespace std;
const int M = 60005;
const int INF = 1e10;
//

struct node
{
    int x, y;
    int step;
    int key;

} st, nx;

int dir[4][2] = { 1,0,-1,0,0,1,0,-1 };
int n, m;
char mp[205][205];
bool vis[205][205][1 << 7];     
int ky[205][205];
int ans, cnt, cur, sx, sy;
bool bol[205][205][1 << 7][4];  //标记状态

int bfs()
{
    queue<node>q;
    memset(vis, 0, sizeof(vis));
    st.x = sx;
    st.y = sy;
    st.step = 0;
    st.key = 0;
    cur = 0;
    cnt = 0;
    vis[st.x][st.y][st.key] = 1;
    q.push(st);
    memset(bol, 0, sizeof(bol));
    while (!q.empty())
    {
        nx = q.front();
        q.pop(
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值