#include <iostream> #include<cstring> using namespace std; int n, m; const int N = 110; int h[N][N]; int f[N][N]; int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1}; int df(int x, int y){ int &v = f[x][y]; if(v != -1) return v; v = 1; for(int i = 0; i < 4; i ++){ ...