Parking
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
In front of Ilona Maksymivna’s house, there is a large rectangular parking lot with \(n\) rows of \(m\) spaces each. In each parking space, she has placed either a rocket or a car.
Ilona wants to fence off a rectangular area such that the number of rockets within this area strictly exceeds the number of cars. In how many ways can she do this?
Note that she can only draw the boundaries of the area along the edges of the parking spaces.
Input
The first line contains two integers \(n\) and \(m\) — the dimensions of the parking lot.
The next \(n\) lines each contain
\(m\) numbers. The number
0 denotes a car, and the number 1 denotes a
rocket.
Output
In a single line, print an integer — the answer to the problem.
Constraints
\(1 \le n, m \le 200\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 3 3 1 0 0 0 1 1 1 0 0 | 7 |
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|