Submission #38403

#TimeUsernameProblemLanguageResultExecution timeMemory
38403Just_Solve_The_ProblemBomb (IZhO17_bomb)C++14
4 / 100
153 ms10804 KiB
#include <bits/stdc++.h>

using namespace std;

const int N = (int)3000;

char c[N][N];

main () {
    bool fl = 1;
    int n, m; scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            char ss; ss = getchar();
            if (ss == '\n')
                j--;
            else {
                c[i][j] = ss;
                if (ss == '1') fl = 0;
            }
        }
    }
    if (fl) assert(false);
    int h = N;
    int w = N;
    for (int i = 1; i <= n; i++) {
        int res = 0;
        for (int j = 1; j <= m; j++) {
            if (c[i][j] == '0' && res != 0) {
                w = min(w, res);
                res = 0;
            }
            if (c[i][j] == '1')
                res++;
        }
        if (res != 0)
            w = min(w, res);
    }
    for (int i = 1; i <= m; i++) {
        int res = 0;
        for (int j = 1; j <= n; j++) {
            if (c[j][i] == '0' && res != 0) {
                h = min(h, res);
                res = 0;
            }
            if (c[j][i] == '1')
                res++;
//            cout << j << ' ' << i << ' ' << res <<  endl;
        }
        if (res != 0)
            h = min(h, res);
    }
//    cout << h << ' ' << w << endl;
    cout << h * w;
}

Compilation message (stderr)

bomb.cpp:9:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
bomb.cpp: In function 'int main()':
bomb.cpp:11:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int n, m; scanf ("%d %d", &n, &m);
                                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...