# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
92567 | Just_Solve_The_Problem | Bomb (IZhO17_bomb) | C++11 | 141 ms | 31224 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 = (int)2500 + 7;
int n, m;
int a[N][N];
main() {
scanf("%d %d", &n, &m);
for (int i = 1; i <= n; i++) {
getchar();
for (int j = 1; j <= m; j++) {
char c;
c = getchar();
a[i][j] = c - '0';
}
}
int mn1, mn2;
mn1 = m;
mn2 = n;
for (int i = 1; i <= n; i++) {
int cur = 0;
for (int j = 1; j <= m; j++) {
if (a[i][j] == 0) {
if (cur) {
mn1 = min(mn1, cur);
}
cur = 0;
} else {
cur++;
}
}
}
for (int i = 1; i <= m; i++) {
int cur = 0;
for (int j = 1; j <= n; j++) {
if (a[j][i] == 0) {
if (cur) {
mn2 = min(mn2, cur);
}
cur = 0;
} else {
cur++;
}
}
}
cout << mn1 * mn2;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |