https://www.acmicpc.net/problem/27211 코드#include #include using namespace std;#define MAX 1001#define FASTIO ios::sync_with_stdio(false); cin.tie(NULL);typedef pair pi;int n, m, arr[MAX][MAX], ans;int dx[4] = { 1, -1, 0, 0 }, dy[4] = { 0, 0, 1, -1 };bool visit[MAX][MAX];void bfs(int x, int y) { queue q; q.push({ x, y }); visit[x][y] = true; while (!q.empty()) { int nx = q.front().first; int n..