764. The biggest plus sign

In a 2D mesh size (0, 0) to (N-1, N-1 ) is  grid , in addition to the  mines unit is given  0, each of the other units are  1. Grid contains  1 the largest axis alignment plus sign is the number of bands? Returns the number of the order plus sign. If the plus sign is not found, 0 is returned.

K "order by the  1 composition of the" "grid having a central axis of symmetry plus sign   grid[x][y] = 1 , and the four upward, downward, leftward from the center, that extends to the right, the length  k-1from  1 the arms thereof. Given below  K " Order example plus sign "axisymmetric." Note that only the grid all the requirements for a plus sign, other grid may be 0 or 1 as possible.

 

Plus sign symmetry axis of order k example:

阶 1:
000
010
000

阶 2:
00000
00100
01110
00100
00000

阶 3:
0000000
0001000
0001000
0111110
0001000
0001000
0000000

 

Example 1:

输入: N = 5, mines = [[4, 2]]
输出: 2
解释:

11111
11111
11111
11111
11011

在上面的网格中,最大加号标志的阶只能是2。一个标志已在图中标出。

 

Example 2:

输入: N = 2, mines = []
输出: 1
解释:

11
11

没有 2 阶加号标志,有 1 阶加号标志。

 

Example 3:

输入: N = 1, mines = [[0, 0]]
输出: 0
解释:

0

没有加号标志,返回 0 。

 

prompt:

  1. Integer Nrange:  [1, 500].
  2. minesThe maximum length  5000.
  3. mines[i]2 by the length of two  [0, N-1] in the number of components.
  4. (In addition, the use of C, C ++, or C # programming will be slightly smaller than the time limit is determined.)

Guess you like

Origin blog.csdn.net/umbrellasoft/article/details/90376761