哎,学到了~!@~!@
//#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(