제출 #833180

#제출 시각아이디문제언어결과실행 시간메모리
833180vjudge1Bomb (IZhO17_bomb)C++17
18 / 100
50 ms7140 KiB
#include <bits/stdc++.h>
using namespace std;

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

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

    string s[n + 5];

    int lr = m;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        int cnt = -1;
        for (int j = 0; j < m; j++) {
            if (s[i][j] == '1') {
                if (cnt == -1) cnt = 1;
                else cnt++;
            } else if (s[i][j] == '0') {
                if (cnt == -1) continue;
                lr = min(lr, cnt);
                cnt = -1;
            }
        }
    }

    int ud = n;
    for (int j = 0; j < m; j++) {
        int cnt = -1;
        for (int i = 0; i < n; i++) {
            if (s[i][j] == '1') {
                if (cnt == -1) cnt = 1;
                else cnt++;
            } else if (s[i][j] == '0') {
                if (cnt == -1) continue;
                ud = min(ud, cnt);
                cnt = -1;
            }
        }
    }
    cout << ud*lr << '\n';

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