Submission #169606

#TimeUsernameProblemLanguageResultExecution timeMemory
169606SamAndBomb (IZhO17_bomb)C++17
24 / 100
117 ms13944 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 3003;

int n, m;
char a[N][N];

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; ++i)
        scanf(" %s", a[i]);
    int nn = n, mm = m;
    for (int i = 0; i < n; ++i)
    {
        int q = 0;
        for (int j = 0; j < m; ++j)
        {
            if (a[i][j] == '1')
                ++q;
            else
            {
                if (q)
                    mm = min(mm, q);
                q = 0;
            }
        }
        if (q)
            mm = min(mm, q);
    }
    for (int j = 0; j < m; ++j)
    {
        int q = 0;
        for (int i = 0; i < n; ++i)
        {
            if (a[i][j] == '1')
                ++q;
            else
            {
                if (q)
                    nn = min(nn, q);
                q = 0;
            }
        }
        if (q)
            nn = min(nn, q);
    }
    printf("%d\n", nn * mm);
    return 0;
}

Compilation message (stderr)

bomb.cpp: In function 'int main()':
bomb.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~
bomb.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %s", a[i]);
         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...