Python AC and the TRICK to avoid TLE
I guess many python people also suffered from the TLE.\n\nHere is my code that just passed. It is not the best. But I just want to jump out to let those python 
I guess many python people also suffered from the TLE.\n\nHere is my code that just passed. It is not the best. But I just want to jump out to let those python guys know this may be what the judge is expecting: avoid looking at those points that can not be better than known best "plus length".\n\nPlease pay attention to this two lines in my code below. This makes my solution from TLE to AC:\n```\nif N-j<=maxmin or N-i<=maxmin:\n    continue\n```\n\nThe main thing that makes it from TLE to AC is that: when we move to area where the max plus length(which is my ```maxmin``` below) is already larger than the distance it can reach the boundary(```N-j``` or ```N-i```), either right boundary or lower boundary, we need to drop those to reduce unnecessary work, because there is no point to keep moving right or keep moving down.\n\n```\nclass Solution(object):\n    def orderOfLargestPlusSign(self, N, mines):\n        if not N: return 0\n        if len(mines)==N*N: return 0\n        self.mmset = []\n        for i in range(N):\n            self.mmset.append([True for j in range(N)])\n        for p in mines:\n            self.mmset[p[0]][p[1]] = False\n            \n        maxmin = 0\n        # using rolling arrays to achieve DP.\n        # the 4 elements tuple means length of 1s for [North, West, South, East].\n        oldline = [[0,0,0,0] for _ in range(N)]\n        for i in range(N):\n            newline = [[0,0,0,0] for _ in range(N)]\n            for j in range(0, N):\n                if not self.mmset[i][j]:\n                    continue\n                if N-j<=maxmin or N-i<=maxmin:\n                    continue\n                newline[j][0] = oldline[j][0] + 1\n                \n                if j==0:\n                    newline[j][1] = 1\n                else:\n                    newline[j][1] = newline[j-1][1]+1\n                \n                if oldline[j][2]==0:\n                    for newi in xrange(i,N):\n                        if self.mmset[newi][j]:\n                            newline[j][2]+=1\n                        else:\n                            break\n                else:\n                    newline[j][2] = oldline[j][2]-1\n                \n                if j==0 or newline[j-1][3]==0:\n                    for newj in xrange(j, N):\n                        if self.mmset[i][newj]:\n                            newline[j][3] += 1\n                        else:\n                            break\n                else:\n                    newline[j][3] = newline[j-1][3]-1\n                \n                maxmin = max(min(newline[j]), maxmin)\n                \n            oldline = newline\n        return maxmin\n                \n```
[]