# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
38385 | Just_Solve_The_Problem | Bomb (IZhO17_bomb) | C++11 | 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 () {
bool fl = 1;
int n, m; scanf ("%d %d", &n, &m);
for (int i = 1; i < N; i++)
for (int j = 1; j < N; j++)
c[i][j] = '0';
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;
if (ss == '1') fl = 0;
}
}
}
if (fl) {
puts("0");
return 0;
}
int ans = 0;
for (int h = 1; h <= n; h++) {
for (int w = 1; w <= m; w++) {
for (int i = 1; i <= n + 1; i++)
for (int j = 1; j <= m + 1; j++)
ex[i][j] = c[i][j];
bool can = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
can = 1;
for (int curi = i, k = 0; k < h; k++, curi++) {
for (int curj = j, l = 0; l < w; l++, curj++) {
if (ex[curi][curj] == '0') {
can = 0;
l = w; k = h;
}
}
}
if (can) {
for (int curi = i, k = 0; k < h; k++, curi++) {
for (int curj = j, l = 0; l < w; 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... |