# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833181 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 255 ms | 49444 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;
int n, m;
const int maxn = 2504;
int chainw[maxn][maxn];
int maxw[maxn];
int chainh[maxn][maxn];
int maxh[maxn];
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
char x;
cin >> x;
if (x == '1') {
chainw[i][j] = chainw[i][j-1]+1;
chainh[i][j] = chainh[i-1][j]+1;
maxw[i] = j;
maxh[j] = i;
}
}
}
int maxpossiblew = maxn;
int maxpossibleh = maxn;
for (int i = 1; i <= n; i++) {
if (maxw[i] == 0) continue;
maxpossiblew = min(maxpossiblew, chainw[i][maxw[i]]);
}
for (int j = 1; j <= m; j++) {
if (maxh[j] == 0) continue;
maxpossibleh = min(maxpossibleh, chainh[maxh[j]][j]);
}
cout << maxpossibleh * maxpossiblew << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |