(i was making a mistake)


#1
vector<vector<int> > Solution::solve(int A, vector<vector<int> > &Bc) {
    vector<vector<int> > B = Bc;
    int rows = B.size();
    if (rows == 0)  return B;
    int cols = B[0].size();
    if (cols == 0)  return B;
    while(A--)
    {
        vector<vector<int>>dp = B;
        for (int i = 0; i < rows; i++)
        {
            for (int j = 0; j < cols; j++)
            {
                if (i - 1 > -1)
                    dp[i][j] = max(dp[i][j], B[i - 1][j]);
                if (i + 1 < rows)
                    dp[i][j] = max(dp[i][j], B[i + 1][j]);
                if (j - 1 > -1)
                    dp[i][j] = max(dp[i][j], B[i][j - 1]);
                if (j + 1 < cols)
                    dp[i][j] = max(dp[i][j], B[i][j + 1]);
            }
        }
        B = dp;
    }
    return B;
}