请问这道“城堡问题”如何理解呢?请帮注释一下,谢谢
#include <stack>
#include <cstring>
using namespace std;
#define MAXN 60
int R,C;
int rooms[MAXN][MAXN];
int color[MAXN][MAXN];
int maxRoomArea = 0;
int colorNum = 0;
int roomArea;
void Dfs(int i, int k) {
if(___color[i][k] ___) {
return;
}
++roomArea;
color[i][k] = colorNum;
if((rooms[i][k] & 1) == 0) {
Dfs(i, k - 1);
}
if((rooms[i][k] & 2) == 0) {
Dfs(__i-1___, k);
}
if((rooms[i][k] & 4) == 0) {
Dfs(i, __k+1___);
}
if((rooms[i][k] & 8) == 0) {
Dfs(i + 1, k);
}
}
int main() {
cin >> R >> C;
for(int i = 1; i <= R; i++)
{
for(int k = 1; k <= C; k++) {
cin >> rooms[i][k];
}
}
memset(color, 0, sizeof(color));
for(int i = 1; i <= R; i++) {
for(int k = 1; k <= C; k++){
if (!color[i][k]) {
____++colorNum ________;
roomArea = 0;
Dfs(i, k);
maxRoomArea = max(roomsArea, maxRoomArea);
}
}
}
cout << colorNum << endl;
cout << maxRoomArea << endl;
return 0;
}