# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
38416 | Just_Solve_The_Problem | Bomb (IZhO17_bomb) | C++14 | 1000 ms | 14272 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)2505;
char c[N][N];
char ex[N][N];
main () {
// #define NAME "bomb"
// freopen(NAME".in", "r", stdin);
// freopen(NAME".out", "w", stdout);
int n, m; scanf ("%d %d", &n, &m);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
char ss; ss = getchar();
if (ss == '\n')
j--;
else {
c[i][j] = ss;
}
}
}
int ans = 0;
for (int h = 1; h <= n; h++) {
for (int w = 1; w <= m; w++) {
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++)
ex[i][j] = c[i][j];
bool can = 1;
for (int i = 1; i <= n - h + 1; i++) {
for (int j = 1; j <= m - w + 1; j++) {
can = 1;
for (int curi = i, k = 0; k < h && curi <= n; k++, curi++) {
for (int curj = j, l = 0; l < w && curj <= m; l++, curj++) {
if (ex[curi][curj] == '0') {
can = 0;
l = w; k = h;
}
}
}
if (can) {
for (int curi = i, k = 0; k < h && curi <= n; k++, curi++) {
for (int curj = j, l = 0; l < w && curj <= m; l++, curj++) {
if (ex[curi][curj] == '1')
ex[curi][curj] = '2';
}
}
}
}
}
can = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (ex[i][j] == '1') can = 0;
}
}
if (can) ans = max(ans, h * w);
}
}
cout << ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |