时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
One deep dark evening, Groundhog was unhappy. It was not until the teacher came that he found he had forgotten to do his homework. In order to save his life, he must immediately hide under the table to prevent himself from being hammered by the teacher.
The desks in his class are arranged in a rectangle of

.

means there is a table at position
%7D)
, otherwise it is not.
In order not to be caught by the teacher, He decided to hide in a subrectangle only if:
- There are no vacancies on the four sides of this subrectangle;
- Because Groundhog is fat, so space can not be too little; However, if there are too many vacancies, Groundhog is easy to be found, so there should not be too many vacancies. Therefore, he hopes that the difference between the number of vacancies in the sub-rectangle and the number of tables is no more than
(excluding the table on the side). - The length and width of the subrectangle must be greater than
.
Groundhog now wants to know: how many sub-rectangles are there that meet the requirements?
输入描述:
Input contains two integer numbers

and

in the range

separated with space(s).
Then n line follow, each contains m characters to describe the rectangle
%7D)
.
输出描述:
The output contains an integer, describing the number of the subrectangles which meet the requirements.
示例1
输入
复制
4 4
1 1 1 1
1 0 1 1
1 1 0 1
1 1 1 1
说明
There're two 2*2 rectangle full of "1",and the whole 4*4 rectangle .
示例2
输入
复制
5 5
1 0 1 1 1
1 0 1 0 1
1 1 0 1 1
1 0 0 1 1
1 1 1 1 1