#abc300c. [abc300_c]Cross
[abc300_c]Cross
Problem Statement
We have a grid with horizontal rows and vertical columns. We denote by the cell at the -th row from the top and -th column from the left of the grid.
Each cell in the grid has a symbol #
or .
written on it. Let C\[i\]\[j\] be the character written on . For integers and such that at least one of and is violated, we define C\[i\]\[j\] to be .
.
squares, consisting of and , are said to be a cross of size centered at if and only if all of the following conditions are satisfied:
- C\[a\]\[b\] is
#
. - C\[a+d\]\[b+d\],C\[a+d\]\[b-d\],C\[a-d\]\[b+d\], and C\[a-d\]\[b-d\] are all
#
, for all integers such that , - At least one of $C\[a+n+1\]\[b+n+1\],C\[a+n+1\]\[b-n-1\],C\[a-n-1\]\[b+n+1\]$, and C\[a-n-1\]\[b-n-1\] is
.
.
For example, the grid in the following figure has a cross of size centered at and another of size centered at .
The grid has some crosses. No #
is written on the cells except for those comprising a cross.
Additionally, no two squares that comprise two different crosses share a corner. The two grids in the following figure are the examples of grids where two squares that comprise different crosses share a corner; such grids are not given as an input. For example, the left grid is invalid because and share a corner.
Let , and be the number of crosses of size . Find .
Constraints
- C\[i\]\[j\] is
#
or.
. - No two different squares that comprise two different crosses share a corner.
- and are integers.
Input
The input is given from Standard Input in the following format:
C\[1\]\[1\]C\[1\]\[2\]\\dots C\[1\]\[W\] C\[2\]\[1\]C\[2\]\[2\]\\dots C\[2\]\[W\] C\[H\]\[1\]C\[H\]\[2\]\\dots C\[H\]\[W\]
Output
Print , and , separated by spaces.
Sample Input 1
5 9
#.#.#...#
.#...#.#.
#.#...#..
.....#.#.
....#...#
Sample Output 1
1 1 0 0 0
As described in the Problem Statement, there are a cross of size centered at and another of size centered at .
Sample Input 2
3 3
...
...
...
Sample Output 2
0 0 0
There may be no cross.
Sample Input 3
3 16
#.#.....#.#..#.#
.#.......#....#.
#.#.....#.#..#.#
Sample Output 3
3 0 0
Sample Input 4
15 20
#.#..#.............#
.#....#....#.#....#.
#.#....#....#....#..
........#..#.#..#...
#.....#..#.....#....
.#...#....#...#..#.#
..#.#......#.#....#.
...#........#....#.#
..#.#......#.#......
.#...#....#...#.....
#.....#..#.....#....
........#.......#...
#.#....#....#.#..#..
.#....#......#....#.
#.#..#......#.#....#
Sample Output 4
5 0 1 0 0 0 1 0 0 0 0 0 0 0 0