제출 #38360

#제출 시각아이디문제언어결과실행 시간메모리
38360Just_Solve_The_ProblemBomb (IZhO17_bomb)C++11
4 / 100
136 ms8144 KiB
#include <bits/stdc++.h>

using namespace std;

const int N = (int)2505;

char c[N][N];

main () {
    #define NAME "bomb"
//    freopen(NAME".in", "r", stdin);
//    freopen(NAME".out", "w", stdout);
    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) {
        puts("0");
        return 0;
    }
    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;
}

컴파일 시 표준 에러 (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:14: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...