#include<bits/stdc++.h> using namespace std; const int N = 3000 + 5; int n, m; int dx[5] = {0, 1, -1, 0, 0}, dy[5] = {0, 0, 0, -1, 1}; bool Map[N][N], vis[N][N], in[N][N]; int maxx, maxtmp; struct Node{ int x, y; }; inline int add (int x, int y) { memset (in, 0, sizeof (in)); int r...