Submission #833224

#TimeUsernameProblemLanguageResultExecution timeMemory
833224vjudge1Bomb (IZhO17_bomb)C++17
11 / 100
243 ms408 KiB
#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);
    for (int j = 1; j <= m; j++) {
        if (prevh[j] > 0)
            maxpossibleh = min(maxpossibleh, prevh[j]);
    }

    cout << maxpossibleh * maxpossiblew << endl;

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...