Submission #38359

#TimeUsernameProblemLanguageResultExecution timeMemory
38359antimirageBomb (IZhO17_bomb)C++14
14 / 100
403 ms26428 KiB
#include <iostream>
#include <vector>
#include <deque>
#include <math.h>
#include <set>
#include <iomanip>
#include <time.h>
#include <list>
#include <stdio.h>
#include <queue>
#include <map>
#include <algorithm>
#include <assert.h>
#include <memory.h>

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )

using namespace std;

const int N = 2500;

int n, m, ar[N][N], h = 1e9 + 7, w = 1e9 +7;

main ()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    {
        scanf("\n");
        for (int j = 1; j <= m; j++)
        {
            char ch;
            scanf("%c", &ch);
            ar[i][j] = ch - 48;
        }
    }
    for (int i = 1; i <= n; i++)
    {
        int l = 0;

        for (int j = 1; j <= m; j++)
        {
            if ( ar[i][j] == 0 || j == m)
            {
                if (!(ar[i][j] == 0 && ar[i][j - 1] == 0))
                    w = min( w, j - l - 1 + (j == m && ar[i][j] == 1) );
                l = j;
            }
        }
    }
    for (int i = 1; i <= m; i++)
    {
        int l = 0;

        for (int j = 1; j <= n; j++)
        {
            if (ar[j][i] == 0 || j == n)
            {
                if (!(ar[j][i] == 0 && ar[j - 1][i] == 0) )
                    h = min( h, j - l - 1 + (j == n && ar[j][i] == 1) );
                l = j;
            }
        }
    }
    if (w == 1e9 + 7) w = 0;

    cout << h * w << endl;
}
/**
1 3
111
**/

Compilation message (stderr)

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