http://acm.hdu.edu.cn/showproblem.php?pid=1010
/*
if calculate the minimum step by BFS,it will get TLE ,too.
学习了新东西,先奇偶性判断
迷宫看成0 1交错的格子,从0到1要奇数步,0到0要偶数步。体会剪枝的重要性
*/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
using namespace std;
char maze[8][8];
int vis[8][8],m,n,t;
int next[4][2]={0,1,0,-1,1,0,-1,0};
bool ok(int x,int y)
{
if(x<0||x>=m||y<0||y>=n||maze[x][y]=='X')
return 0;
return 1;
}
int flag;
void dfs(int x,int y,int st)
{
if(flag)
return ;
if(st