Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#include<cstdio>#include<vector>#include<cstring>using namespace std;/* run this program using the console pauser or add your own getch, system("pause") or input loop *///#define ONLINE_JUDGE#ifndef ONLINE_JUDGE#pragma warning(disable:3399)#endifint M,N;char map[101][101];int step[101] [101];vector< pair<int, int> > seq;int dir[4][2]={{-1,0},{1,0},{0,-1},{0,1}};bool InMap(int x,int y){if((x>=1&&x<=N&&y>=1&&y<=M)&&(map[x][y]=='S'||map[x][y]=='.'))return true;elsereturn false;}void BFS(int startX, int startY){step[startX][startY]=0;seq.push_back(make_pair(startX,startY));