题解
比较有意思的一道题目。大体概念是图搜索和洪水填充。
前两个问题用dfs就可以解决,后两问遍历对所有房间,检验N和E墙即可。
思路很清楚,但写起来还是要仔细。
代码
/*
PROG:castle
ID:imking022
LANG:C++
*/
#include <iostream>
#include <cstdio>
#include <fstream>
#include <cstring>
#include <string>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
int n,m,ans,mark;
int cot[51][51],mk[51][51];
bool vis[51][51];
int reff[4][2] = { {
0,-1}, {-1,0<