Because 1M * 1M is too large for BFS, so we need to find a way to return quickly.
blocked.length <= 200 is a good quality we can look into. In a square, the best way to lock an area is laying all blocks 45° as following:
1 2 3 4 5 6 7 8 9
0th _________________________ |O O O O O O O X |O O O O O O X |O O O O O X |O O O O X .O O O X .O O X .O X 200th |X
And there are maximally (199 + 1) * 199 /2 = 19900 grids. The exceeding of this number means we can not block one source. So we can return quickly by determine if 19901’s grid has been visited.