#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
bomb.cpp:10:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main () {
^
bomb.cpp: In function 'int main()':
bomb.cpp:14:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
int n, m; scanf ("%d %d", &n, &m);
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
14272 KB |
Output is correct |
2 |
Incorrect |
0 ms |
14272 KB |
Output isn't correct |
3 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
4 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
5 |
Correct |
736 ms |
14272 KB |
Output is correct |
6 |
Incorrect |
266 ms |
14272 KB |
Output isn't correct |
7 |
Correct |
0 ms |
14272 KB |
Output is correct |
8 |
Incorrect |
0 ms |
14272 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
14272 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
14272 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
14272 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
14272 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
14272 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
14272 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
14272 KB |
Output isn't correct |
16 |
Incorrect |
3 ms |
14272 KB |
Output isn't correct |
17 |
Incorrect |
116 ms |
14272 KB |
Output isn't correct |
18 |
Incorrect |
63 ms |
14272 KB |
Output isn't correct |
19 |
Incorrect |
246 ms |
14272 KB |
Output isn't correct |
20 |
Incorrect |
259 ms |
14272 KB |
Output isn't correct |
21 |
Incorrect |
79 ms |
14272 KB |
Output isn't correct |
22 |
Incorrect |
176 ms |
14272 KB |
Output isn't correct |
23 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
24 |
Incorrect |
196 ms |
14272 KB |
Output isn't correct |
25 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
26 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
27 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
28 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
29 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
30 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
31 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
32 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
33 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
34 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
35 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
36 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
37 |
Incorrect |
0 ms |
14272 KB |
Output isn't correct |
38 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
39 |
Incorrect |
0 ms |
14272 KB |
Output isn't correct |
40 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
41 |
Incorrect |
3 ms |
14272 KB |
Output isn't correct |
42 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
43 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
44 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
45 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
46 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
47 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
48 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
49 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
50 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
51 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
52 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
53 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
54 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
55 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
56 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
57 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
58 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
59 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
60 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
61 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
62 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
63 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
64 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
65 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
66 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
67 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
68 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
69 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
70 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
71 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
72 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
73 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
74 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
75 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
76 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
77 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
78 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
79 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
80 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
81 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
82 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
83 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
84 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
85 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
86 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
87 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
88 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
89 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
90 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
91 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
92 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
93 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
94 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
95 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
96 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
97 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
98 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
99 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |
100 |
Execution timed out |
1000 ms |
14272 KB |
Execution timed out |