Submission #94285

#TimeUsernameProblemLanguageResultExecution timeMemory
94285KastandaBomb (IZhO17_bomb)C++11
24 / 100
90 ms12536 KiB
#include<bits/stdc++.h>
using namespace std;
const int N = 2505;
int n, m, Mnx, Mny;
char A[N][N];
int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++)
        scanf("%s", &A[i][1]);
    Mnx = m; Mny = n;

    for (int i = 1; i <= n; i++)
    {
        int last = 0;
        for (int j = 1; j <= m; j++)
            if (A[i][j] == '0')
            {
                if (last != j - 1)
                    Mnx = min(Mnx, j - last - 1);
                last = j;
            }
        if (last != m)
            Mnx = min(Mnx, m - last);
    }

    for (int i = 1; i <= m; i++)
    {
        int last = 0;
        for (int j = 1; j <= n; j++)
            if (A[j][i] == '0')
            {
                if (last != j - 1)
                    Mny = min(Mny, j - last - 1);
                last = j;
            }
        if (last != n)
            Mny = min(Mny, n - last);
    }
    return !printf("%d", Mnx * Mny);
}

Compilation message (stderr)

bomb.cpp: In function 'int main()':
bomb.cpp:8: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:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s", &A[i][1]);
         ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...