Submission #170217

#TimeUsernameProblemLanguageResultExecution timeMemory
170217theboatmanBomb (IZhO17_bomb)C++17
24 / 100
50 ms13184 KiB
#include <bits/stdc++.h>

#define y1 theboatman
#define make_struct(args...) {args}

using namespace std;
typedef long long ll;

const long long INF = ll(1e18) + 10;
const int inf = int(1e9) + 10;
const int N = int(1e6) + 10;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    int n, m;
    cin >> n >> m;

    vector <string> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int second = m;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            if (a[i][j] == '1') {
                int sz = 0;
                while(j < m && a[i][j] == '1') {
                    j++;
                    sz++;
                }
                j--;

                second = min(second, sz);
            }
        }
    }

    int first = n;
    for(int j = 0; j < m; j++) {
        for(int i = 0; i < n; i++) {
            if (a[i][j] == '1') {
                int sz = 0;
                while(i < n && a[i][j] == '1') {
                    i++;
                    sz++;
                }
                i--;

                first = min(first, sz);
            }
        }
    }

    cout << 1LL * first * second << "\n";
    return 0;
}
/*
*/
#Verdict Execution timeMemoryGrader output
Fetching results...