# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91491 | davitmarg | Bomb (IZhO17_bomb) | C++17 | 449 ms | 49796 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
DEATH-MATCH
Davit-Marg
*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iterator>
#include <ctype.h>
#include <stdlib.h>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
using namespace std;
LL n, m,w,h;
LL mp[2503][2503];
char tmp;
int main()
{
cin >> n >> m;
w = h = mod;
for (LL i = 0; i < n; i++)
for (LL j = 0; j < m; j++)
{
cin >> tmp;
mp[i][j] = tmp - '0';
}
for (LL i = 0; i < n; i++)
{
LL l = 0;
for (LL j = 0; j < m; j++)
if (mp[i][j] != 1)
{
if (j != l)
w = min(w, j - l);
l = j + 1;
}
if (m != l)
w = min(w, m - l);
}
for (LL i = 0; i < m; i++)
{
LL l = 0;
for (LL j = 0; j < n; j++)
if (mp[j][i] != 1)
{
if(j!=l)
h = min(h, j - l);
l = j + 1;
}
if (n != l)
h = min(h, n - l);
}
if (w == mod && h == mod)
w = 0;
cout << w * h << endl;
return 0;
}
/*
7 8
01001110
01001110
01001100
00000000
01000000
01000000
01000000
7 8
00000000
00000000
00000000
00000000
00000000
00000000
00000000
7 8
11111111
11111111
11111111
11100111
11111111
11111111
11111111
7 8
00000000
00011000
00011000
00000000
00011111
00011111
00000000
*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |