#P10719. [GESP202406 五级] 黑白格
[GESP202406 五级] 黑白格
Background
Related multiple-choice and true/false questions: https://ti.luogu.com.cn/problemset/1153.
Problem Description
Xiao Yang has a grid with rows and columns, where each cell is either white or black.
Xiao Yang wants to know how many cells are contained in the smallest sub-rectangle that contains at least black cells.
Input Format
The first line contains three positive integers , with meanings as described in the statement.
Then follow lines, each containing a string of length , representing the colors of the cells in row of the grid. If it is , the corresponding cell is white; otherwise, it is black.
Output Format
Output one integer, representing the number of cells contained in the smallest sub-rectangle that contains at least black cells. If it does not exist, output .
4 5 5
00000
01111
00011
00011
6
Hint
Sample Explanation
For sample , let represent row and column . The four vertices of the smallest sub-rectangle that contains at least black cells are , , , , and it contains a total of cells.
Constraints
For all data, it is guaranteed that and .
| Subtask ID | Score | |
|---|---|---|
| , | ||
Update on 2024/7/9: Several groups of hack testdata were added. Thanks to @cff_0102 for the contribution.
Translated by ChatGPT 5