#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <queue> #include <climits> using namespace std; const int dx[4] = { 0, 0, 1, -1 }; const int dy[4] = { 1, -1, 0, 0 }; int n, m; char arr[1005][1005]; bool visited[1005][1005]; int main() { scanf("%d%d", &n, &...