# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
94285 | Kastanda | Bomb (IZhO17_bomb) | C++11 | 90 ms | 12536 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.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |