제출 #44550

#제출 시각아이디문제언어결과실행 시간메모리
44550nickyrioBomb (IZhO17_bomb)C++17
24 / 100
111 ms131072 KiB
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, a) for (int i = 0; i < (a); ++i)
#define DEBUG(x) { cerr << #x << '=' << x << endl; }
#define Arr(a, l, r) { cerr << #a << " = {"; FOR(_, l, r) cerr << ' ' << a[_]; cerr << "}\n"; }
#define N 2505
#define pp pair<int, int>
#define endl '\n'
#define IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define taskname ""
#define bit(S, i) (((S) >> (i)) & 1)
using namespace std;
string st[N];

int main() {
    #ifdef NERO
    freopen("test.inp","r",stdin);
    freopen("test.out","w",stdout);
    double stime = clock();
    #else 
        //freopen(taskname".inp","r",stdin);
        //freopen(taskname".out","w",stdout);
    #endif //NERO
    IO;
    int n, m;
    cin >> m >> n;
    FOR(i, 1, m) {
        cin >> st[i];
        st[i] = '0' + st[i] + '0';
    }
    FOR(i, 0, n + 1) st[0].push_back('0');
    st[m + 1] = st[0];
    int w = n;
    FOR(i, 1, m) {
        int zero = 0;
        FOR(j, 1, n + 1) {
            if (st[i][j] == '0') {
                if (zero + 1 != j) w = min(w, j - zero - 1);
                zero = j;
            }
        }
    } 
    int h = m;
    FOR(j, 1, n) {
        int zero = 0;
        FOR(i, 1, m + 1) {
            if (st[i][j] == '0') {
                if (zero + 1 != i) h = min(h, i - zero - 1);
                zero = i;
            }
        }
    }
    cout << h * w;
    #ifdef NERO
    double etime = clock();
    cerr << "Execution time: " << (etime - stime) / CLOCKS_PER_SEC * 1000 << " ms.\n";
    #endif // NERO
}
#Verdict Execution timeMemoryGrader output
Fetching results...