#P6600. 「EZEC-2」字母
「EZEC-2」字母
Description
A “letter T” consists of one horizontal stroke and one vertical stroke, and the vertical stroke must be below the horizontal stroke (you may use the English letter T to help understand).
In this problem, we define the “horizontal stroke” as the horizontal line segment forming the “letter T”, and the “vertical stroke” as the vertical line segment forming the “letter T”.
Note that the overlapping part of the horizontal and vertical strokes is counted in both the horizontal length and the vertical length.
For a valid “letter T”, the length of the horizontal stroke must be odd, and the vertical stroke must intersect the horizontal stroke at its midpoint. The minimum horizontal length is , and the minimum vertical length is .
For example:
$$\begin{array}{ccc} 0\color{Red}111\color{black}1\\ 00\color{Red}1\color{black}01 \end{array}$$There is only one valid “letter T” (the red part).
Now you are given a matrix. Please find, among all valid “letter T”s in this matrix, how many “letter T”s satisfy the following conditions.
Suppose a valid “letter T” has horizontal length and vertical length . Then:
Two “letter T”s are considered different if their horizontal length, vertical length, or the coordinates of the top-left corner are different.
Input Format
The first line contains two integers , meaning the given matrix has rows and columns.
The second line contains four integers .
The next lines each contain numbers, which can only be or , representing the given matrix.
Output Format
Output one integer, the number of valid “letter T”s that satisfy the conditions.
5 5
3 3 18 9
11111
01110
11111
01110
11111
2
5 5
3 3 15 7
11111
01110
11111
01110
11111
7
10 10
5 4 40 11
0011111111
1011110101
1111111111
1001111101
1111101111
1111110110
0111011101
0111111110
0011111111
0111111101
8
Hint
[Sample Explanation #1]
$$\begin{array}{ccc} \color{Red}11111\qquad11111\\01\color{Red}1\color{black}10\qquad01\color{Red}1\color{black}10\\ 11\color{Red}1\color{black}11\qquad11\color{Red}1\color{black}11\\ 01\color{Red}1\color{black}10\qquad01\color{Red}1\color{black}10\\ 11111\qquad11\color{Red}1\color{black}11\\\\ The\ 1st\qquad The\ 2nd \end{array}$$Other than the two “letter T”s above, there are no other valid “letter T”s that satisfy the conditions, so the output is .
[Constraints]
| Test Point ID | | | | |
| :----------: | :----------: | :----------: | :----------: | :----------: |
| | | |||
| | | |||
| | | |||
| | ||||
| | ||||
| | ||||
For of the testdata, , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号