#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<string> a(n);
for (auto &i : a)
cin >> i;
int mx = 1;
for (int x = 1; x <= n; x++) {
for (int y = 1; y <= m; y++) {
if (x * y <= mx) continue;
bool ok = true;
vector<vector<bool>> vis(n, vector<bool>(m));
for (int i = 0; i + x <= n; i++) {
for (int j = 0; j + y <= m; j++) {
if (a[i][j] == '0') continue;
bool tr = true;
for (int k = i; k < i + x && tr; k++) {
for (int l = j; l < j + y && tr; l++)
tr = (a[k][l] == '1');
}
ok = vis[i][j];
if (!tr) continue;
for (int k = i; k < i + x; k++) {
for (int l = j; l < j + y; l++)
vis[k][l] = true;
}
ok = vis[i][j];
}
}
for (int i = 0; i < n && ok; i++) {
for (int j = 0; j < m && ok; j++)
ok = (a[i][j] == '0' || vis[i][j]);
}
if (ok) mx = max(mx, x * y);
}
}
cout << mx;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Execution timed out |
1069 ms |
592 KB |
Time limit exceeded |
4 |
Execution timed out |
1067 ms |
592 KB |
Time limit exceeded |
5 |
Correct |
268 ms |
336 KB |
Output is correct |
6 |
Correct |
142 ms |
584 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
2 ms |
336 KB |
Output is correct |
17 |
Correct |
34 ms |
348 KB |
Output is correct |
18 |
Correct |
67 ms |
336 KB |
Output is correct |
19 |
Correct |
98 ms |
504 KB |
Output is correct |
20 |
Correct |
123 ms |
336 KB |
Output is correct |
21 |
Correct |
34 ms |
336 KB |
Output is correct |
22 |
Correct |
76 ms |
336 KB |
Output is correct |
23 |
Correct |
429 ms |
336 KB |
Output is correct |
24 |
Correct |
87 ms |
456 KB |
Output is correct |
25 |
Correct |
762 ms |
336 KB |
Output is correct |
26 |
Execution timed out |
1074 ms |
336 KB |
Time limit exceeded |
27 |
Execution timed out |
1075 ms |
336 KB |
Time limit exceeded |
28 |
Execution timed out |
1047 ms |
592 KB |
Time limit exceeded |
29 |
Execution timed out |
1070 ms |
592 KB |
Time limit exceeded |
30 |
Execution timed out |
1051 ms |
592 KB |
Time limit exceeded |
31 |
Execution timed out |
1074 ms |
592 KB |
Time limit exceeded |
32 |
Execution timed out |
1067 ms |
592 KB |
Time limit exceeded |
33 |
Execution timed out |
1071 ms |
592 KB |
Time limit exceeded |
34 |
Execution timed out |
1068 ms |
336 KB |
Time limit exceeded |
35 |
Execution timed out |
1052 ms |
592 KB |
Time limit exceeded |
36 |
Execution timed out |
1051 ms |
592 KB |
Time limit exceeded |
37 |
Correct |
2 ms |
336 KB |
Output is correct |
38 |
Execution timed out |
1093 ms |
8116 KB |
Time limit exceeded |
39 |
Correct |
1 ms |
336 KB |
Output is correct |
40 |
Execution timed out |
1100 ms |
1360 KB |
Time limit exceeded |
41 |
Correct |
2 ms |
336 KB |
Output is correct |
42 |
Execution timed out |
1089 ms |
424 KB |
Time limit exceeded |
43 |
Execution timed out |
1070 ms |
8172 KB |
Time limit exceeded |
44 |
Execution timed out |
1065 ms |
592 KB |
Time limit exceeded |
45 |
Execution timed out |
1070 ms |
8084 KB |
Time limit exceeded |
46 |
Execution timed out |
1066 ms |
8188 KB |
Time limit exceeded |
47 |
Execution timed out |
1076 ms |
8076 KB |
Time limit exceeded |
48 |
Execution timed out |
1058 ms |
8068 KB |
Time limit exceeded |
49 |
Execution timed out |
1072 ms |
8304 KB |
Time limit exceeded |
50 |
Execution timed out |
1067 ms |
8084 KB |
Time limit exceeded |
51 |
Execution timed out |
1066 ms |
8072 KB |
Time limit exceeded |
52 |
Execution timed out |
1072 ms |
8092 KB |
Time limit exceeded |
53 |
Execution timed out |
1062 ms |
8076 KB |
Time limit exceeded |
54 |
Execution timed out |
1069 ms |
8084 KB |
Time limit exceeded |
55 |
Execution timed out |
1080 ms |
8096 KB |
Time limit exceeded |
56 |
Execution timed out |
1052 ms |
8076 KB |
Time limit exceeded |
57 |
Execution timed out |
1078 ms |
8080 KB |
Time limit exceeded |
58 |
Execution timed out |
1067 ms |
8076 KB |
Time limit exceeded |
59 |
Execution timed out |
1072 ms |
8068 KB |
Time limit exceeded |
60 |
Execution timed out |
1068 ms |
8088 KB |
Time limit exceeded |
61 |
Execution timed out |
1063 ms |
8084 KB |
Time limit exceeded |
62 |
Execution timed out |
1066 ms |
8076 KB |
Time limit exceeded |
63 |
Execution timed out |
1074 ms |
8108 KB |
Time limit exceeded |
64 |
Execution timed out |
1068 ms |
8308 KB |
Time limit exceeded |
65 |
Execution timed out |
1058 ms |
8088 KB |
Time limit exceeded |
66 |
Execution timed out |
1062 ms |
8088 KB |
Time limit exceeded |
67 |
Execution timed out |
1071 ms |
8080 KB |
Time limit exceeded |
68 |
Execution timed out |
1041 ms |
8312 KB |
Time limit exceeded |
69 |
Execution timed out |
1076 ms |
8088 KB |
Time limit exceeded |
70 |
Execution timed out |
1051 ms |
5428 KB |
Time limit exceeded |
71 |
Execution timed out |
1065 ms |
8084 KB |
Time limit exceeded |
72 |
Execution timed out |
1067 ms |
8356 KB |
Time limit exceeded |
73 |
Execution timed out |
1059 ms |
8188 KB |
Time limit exceeded |
74 |
Execution timed out |
1042 ms |
8292 KB |
Time limit exceeded |
75 |
Execution timed out |
1078 ms |
8184 KB |
Time limit exceeded |
76 |
Execution timed out |
1038 ms |
8092 KB |
Time limit exceeded |
77 |
Execution timed out |
1048 ms |
8084 KB |
Time limit exceeded |
78 |
Execution timed out |
1060 ms |
8076 KB |
Time limit exceeded |
79 |
Execution timed out |
1078 ms |
8108 KB |
Time limit exceeded |
80 |
Execution timed out |
1057 ms |
8112 KB |
Time limit exceeded |
81 |
Execution timed out |
1057 ms |
8088 KB |
Time limit exceeded |
82 |
Execution timed out |
1068 ms |
8232 KB |
Time limit exceeded |
83 |
Execution timed out |
1065 ms |
8208 KB |
Time limit exceeded |
84 |
Execution timed out |
1061 ms |
8084 KB |
Time limit exceeded |
85 |
Execution timed out |
1073 ms |
8220 KB |
Time limit exceeded |
86 |
Execution timed out |
1080 ms |
8208 KB |
Time limit exceeded |
87 |
Execution timed out |
1070 ms |
8208 KB |
Time limit exceeded |
88 |
Execution timed out |
1066 ms |
8092 KB |
Time limit exceeded |
89 |
Execution timed out |
1070 ms |
8084 KB |
Time limit exceeded |
90 |
Execution timed out |
1059 ms |
5336 KB |
Time limit exceeded |
91 |
Execution timed out |
1063 ms |
8084 KB |
Time limit exceeded |
92 |
Execution timed out |
1053 ms |
8116 KB |
Time limit exceeded |
93 |
Execution timed out |
1071 ms |
8112 KB |
Time limit exceeded |
94 |
Execution timed out |
1071 ms |
8092 KB |
Time limit exceeded |
95 |
Execution timed out |
1042 ms |
8088 KB |
Time limit exceeded |
96 |
Execution timed out |
1056 ms |
8088 KB |
Time limit exceeded |
97 |
Execution timed out |
1055 ms |
8212 KB |
Time limit exceeded |
98 |
Execution timed out |
1034 ms |
8088 KB |
Time limit exceeded |
99 |
Execution timed out |
1046 ms |
8264 KB |
Time limit exceeded |
100 |
Execution timed out |
1030 ms |
8084 KB |
Time limit exceeded |