Solution
C++ []\nclass Solution {\npublic:\n    int orderOfLargestPlusSign(int N, vector<vector<int>>& mines) {\n        int ans=0,s,i,j,k;\n        int dp[N+2][N+2][4],
```C++ []\nclass Solution {\npublic:\n    int orderOfLargestPlusSign(int N, vector<vector<int>>& mines) {\n        int ans=0,s,i,j,k;\n        int dp[N+2][N+2][4],v[N][N];\n        for(i=0;i<N;i++)for(j=0;j<N;j++)v[i][j]=1;\n        for(i=0;i<mines.size();i++)v[mines[i][0]][mines[i][1]]=0;\n        memset(dp,0,sizeof dp);\n        \n        for(i=0;i<N;i++){\n            for(j=0;j<N;j++){\n                if(v[i][j]==1){\n                    dp[i+1][j+1][0]=dp[i][j+1][0]+1;\n                    dp[i+1][j+1][1]=dp[i+1][j][1]+1;\n                }\n            }\n        }\n        for(i=N-1;i>=0;i--){\n            for(j=N-1;j>=0;j--){\n                if(v[i][j]==1){\n                    dp[i+1][j+1][2]=dp[i+2][j+1][2]+1;\n                    dp[i+1][j+1][3]=dp[i+1][j+2][3]+1;\n                }\n            }\n        }\n        for(i=1;i<=N;i++){\n            for(j=1;j<=N;j++){\n                s=min(dp[i][j][0],min(dp[i][j][1],min(dp[i][j][2],dp[i][j][3])));\n                ans=max(ans,s);\n            }\n        }\n        return ans;\n    }\n};\n```\n\n```Python3 []\nclass Solution:\n    def orderOfLargestPlusSign(self, N: int, mines: List[List[int]]) -> int:\n        rows = [[-1, N] for _ in range(N)]\n        cols = [[-1, N] for _ in range(N)]\n        for r, c in mines:\n            rows[r].append(c)\n            cols[c].append(r)\n        for i in range(N):\n            rows[i].sort()\n            cols[i].sort()\n        mxp = 0\n        for r in range(N):\n            for i in range(len(rows[r]) - 1):\n                left_b = rows[r][i]\n                right_b = rows[r][i+1]\n                for c in range(left_b + mxp + 1, right_b - mxp):\n                    idx = bisect_right(cols[c], r) - 1\n                    up_b = cols[c][idx]\n                    down_b = cols[c][idx + 1]\n                    mxp = max(mxp, min(c - left_b, right_b - c, r - up_b, down_b - r))\n        return mxp\n```\n\n```Java []\nclass Solution {\n    public int orderOfLargestPlusSign(int n, int[][] mines) {\n        int[][] dp = new int[n][n];\n        for(int[] mine : mines) {\n            int row = mine[0], col = mine[1];\n            dp[row][col] = -1;\n        }\n        for(int row = 0; row < n; row++) {\n            int count = 0;\n            for(int col = 0; col < n; col++) {\n                if(dp[row][col] == -1) {\n                    count = 0;\n                } else {\n                    count += 1;\n                    dp[row][col] =  count;\n                }\n            }\n            count = 0;\n            for(int col = n - 1; col >= 0; col--) {\n                if(dp[row][col] == -1) {\n                    count = 0;\n                } else {\n                    count += 1;\n                    dp[row][col] = Math.min(dp[row][col], count);\n                }\n            }\n        }\n        int max = 0;\n        for(int col = 0; col < n; col++) {\n            int count = 0;\n            for(int row = 0; row < n; row++) {\n                if(dp[row][col] == -1) {\n                    count = 0;\n                } else {\n                    count += 1;\n                    dp[row][col] = Math.min(dp[row][col], count);\n                }\n            }\n            count = 0;\n            for(int row = n - 1; row >= 0; row--) {\n                if(dp[row][col] == -1) {\n                    count = 0;\n                } else {\n                    count += 1;\n                    dp[row][col] = Math.min(dp[row][col], count);\n                }\n                max = Math.max(max, dp[row][col]);\n            }\n        }\n        return max;\n    }\n}\n```\n
['C++', 'Java', 'Python3']