This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int n, m;
const int maxn = 2504;
int prevw;
int prevh[maxn];
int main() {
    cin >> n >> m;
    int maxpossiblew = maxn;
    int maxpossibleh = maxn;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            char x;
            cin >> x;
            if (x == '1') {
                prevw++;
                prevh[j]++;
            } else {
                if (prevw > 0) {
                    maxpossiblew = min(maxpossiblew, prevw);
                }
                if (prevh[j] > 0) {
                    maxpossibleh = min(maxpossibleh, prevh[j]);
                }
                prevw = 0;
                prevh[j] = 0;
            }
        }
        if (prevw > 0) {
            maxpossiblew = min(maxpossiblew, prevw);
        }
        prevw = 0;
    }
    for (int j = 1; j <= m; j++) {
        if (prevh[j] > 0)
            maxpossibleh = min(maxpossibleh, prevh[j]);
    }
    cout << maxpossibleh * maxpossiblew << endl;
    return 0;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |