class Solution { public: //记录四个方向 int dirs[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; int n, m; //深度优先搜索,返回最大单元格数 int dfs(vector<vector<int> > &matrix, vector<vector<int> > &dp, int i, int j) { if(dp[i][j] != 0) return dp[i][j]...