#include <bits/stdc++.h>
using namespace std;
const int N = 2505;
int n, m;
char c[N][N], c1[N][N];
bool f(int a, int b){
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
c1[i][j] = c[i][j];
}
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
bool tr = 0;
if(i + a - 1 <= n and j + b - 1 <= m){
for(int i1 = i; i1 <= i+a-1; i1++){
for(int j1 = j; j1 <= j+b-1; j1++){
if(c[i1][j1] == '0'){
tr = 1;
break;
}
}
}
if(tr == 0){
for(int i1 = i; i1 <= i+a-1; i1++){
for(int j1 = j; j1 <= j+b-1; j1++){
c1[i1][j1] = '0';
}
}
}
}
}
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
if(c1[i][j] == '1') return false;
}
}
return true;
}
int main(){
cin >> n >> m;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
cin >> c[i][j];
}
}
int ans = 0;
for(int a = 1; a <= n; a++){
for(int b = 1; b <= m; b++){
if(f(a,b) == true) ans = max(a*b, ans);
}
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Execution timed out |
1065 ms |
12796 KB |
Time limit exceeded |
4 |
Execution timed out |
1064 ms |
12624 KB |
Time limit exceeded |
5 |
Correct |
292 ms |
2384 KB |
Output is correct |
6 |
Correct |
86 ms |
2384 KB |
Output is correct |
7 |
Correct |
1 ms |
2384 KB |
Output is correct |
8 |
Correct |
2 ms |
2384 KB |
Output is correct |
9 |
Correct |
2 ms |
2384 KB |
Output is correct |
10 |
Correct |
1 ms |
2384 KB |
Output is correct |
11 |
Correct |
2 ms |
2384 KB |
Output is correct |
12 |
Correct |
1 ms |
2384 KB |
Output is correct |
13 |
Correct |
1 ms |
2384 KB |
Output is correct |
14 |
Correct |
1 ms |
2384 KB |
Output is correct |
15 |
Correct |
2 ms |
2600 KB |
Output is correct |
16 |
Correct |
7 ms |
2384 KB |
Output is correct |
17 |
Correct |
469 ms |
2640 KB |
Output is correct |
18 |
Correct |
137 ms |
2640 KB |
Output is correct |
19 |
Execution timed out |
1014 ms |
6760 KB |
Time limit exceeded |
20 |
Execution timed out |
1060 ms |
6736 KB |
Time limit exceeded |
21 |
Correct |
105 ms |
2384 KB |
Output is correct |
22 |
Correct |
399 ms |
4688 KB |
Output is correct |
23 |
Execution timed out |
1072 ms |
6736 KB |
Time limit exceeded |
24 |
Correct |
780 ms |
4688 KB |
Output is correct |
25 |
Execution timed out |
1065 ms |
6736 KB |
Time limit exceeded |
26 |
Execution timed out |
1077 ms |
6736 KB |
Time limit exceeded |
27 |
Execution timed out |
1080 ms |
6736 KB |
Time limit exceeded |
28 |
Execution timed out |
1045 ms |
6736 KB |
Time limit exceeded |
29 |
Execution timed out |
1050 ms |
6736 KB |
Time limit exceeded |
30 |
Execution timed out |
1046 ms |
6736 KB |
Time limit exceeded |
31 |
Execution timed out |
1048 ms |
6736 KB |
Time limit exceeded |
32 |
Execution timed out |
1056 ms |
6608 KB |
Time limit exceeded |
33 |
Execution timed out |
1051 ms |
6736 KB |
Time limit exceeded |
34 |
Execution timed out |
1068 ms |
6736 KB |
Time limit exceeded |
35 |
Execution timed out |
1063 ms |
6736 KB |
Time limit exceeded |
36 |
Execution timed out |
1036 ms |
6736 KB |
Time limit exceeded |
37 |
Correct |
3 ms |
2384 KB |
Output is correct |
38 |
Execution timed out |
1098 ms |
12488 KB |
Time limit exceeded |
39 |
Correct |
3 ms |
2384 KB |
Output is correct |
40 |
Execution timed out |
1097 ms |
6584 KB |
Time limit exceeded |
41 |
Correct |
3 ms |
2384 KB |
Output is correct |
42 |
Execution timed out |
1091 ms |
6736 KB |
Time limit exceeded |
43 |
Execution timed out |
1050 ms |
12468 KB |
Time limit exceeded |
44 |
Execution timed out |
1063 ms |
6736 KB |
Time limit exceeded |
45 |
Execution timed out |
1072 ms |
12616 KB |
Time limit exceeded |
46 |
Execution timed out |
1051 ms |
12468 KB |
Time limit exceeded |
47 |
Execution timed out |
1066 ms |
12616 KB |
Time limit exceeded |
48 |
Execution timed out |
1055 ms |
12468 KB |
Time limit exceeded |
49 |
Execution timed out |
1063 ms |
12468 KB |
Time limit exceeded |
50 |
Execution timed out |
1050 ms |
12616 KB |
Time limit exceeded |
51 |
Execution timed out |
1052 ms |
12616 KB |
Time limit exceeded |
52 |
Execution timed out |
1077 ms |
12616 KB |
Time limit exceeded |
53 |
Execution timed out |
1044 ms |
12616 KB |
Time limit exceeded |
54 |
Execution timed out |
1062 ms |
12616 KB |
Time limit exceeded |
55 |
Execution timed out |
1035 ms |
12616 KB |
Time limit exceeded |
56 |
Execution timed out |
1070 ms |
12472 KB |
Time limit exceeded |
57 |
Execution timed out |
1073 ms |
12616 KB |
Time limit exceeded |
58 |
Execution timed out |
1075 ms |
12476 KB |
Time limit exceeded |
59 |
Execution timed out |
1074 ms |
12472 KB |
Time limit exceeded |
60 |
Execution timed out |
1059 ms |
12476 KB |
Time limit exceeded |
61 |
Execution timed out |
1074 ms |
12468 KB |
Time limit exceeded |
62 |
Execution timed out |
1059 ms |
12616 KB |
Time limit exceeded |
63 |
Execution timed out |
1072 ms |
12472 KB |
Time limit exceeded |
64 |
Execution timed out |
1079 ms |
12616 KB |
Time limit exceeded |
65 |
Execution timed out |
1063 ms |
12616 KB |
Time limit exceeded |
66 |
Execution timed out |
1055 ms |
12616 KB |
Time limit exceeded |
67 |
Execution timed out |
1042 ms |
12616 KB |
Time limit exceeded |
68 |
Execution timed out |
1059 ms |
12616 KB |
Time limit exceeded |
69 |
Execution timed out |
1048 ms |
12616 KB |
Time limit exceeded |
70 |
Execution timed out |
1075 ms |
11452 KB |
Time limit exceeded |
71 |
Execution timed out |
1047 ms |
12472 KB |
Time limit exceeded |
72 |
Execution timed out |
1053 ms |
12616 KB |
Time limit exceeded |
73 |
Execution timed out |
1073 ms |
12616 KB |
Time limit exceeded |
74 |
Execution timed out |
1059 ms |
12616 KB |
Time limit exceeded |
75 |
Execution timed out |
1066 ms |
12616 KB |
Time limit exceeded |
76 |
Execution timed out |
1068 ms |
12476 KB |
Time limit exceeded |
77 |
Execution timed out |
1071 ms |
12616 KB |
Time limit exceeded |
78 |
Execution timed out |
1049 ms |
12492 KB |
Time limit exceeded |
79 |
Execution timed out |
1056 ms |
12616 KB |
Time limit exceeded |
80 |
Execution timed out |
1035 ms |
12468 KB |
Time limit exceeded |
81 |
Execution timed out |
1066 ms |
12476 KB |
Time limit exceeded |
82 |
Execution timed out |
1048 ms |
12616 KB |
Time limit exceeded |
83 |
Execution timed out |
1071 ms |
12476 KB |
Time limit exceeded |
84 |
Execution timed out |
1069 ms |
12616 KB |
Time limit exceeded |
85 |
Execution timed out |
1058 ms |
12616 KB |
Time limit exceeded |
86 |
Execution timed out |
1070 ms |
12616 KB |
Time limit exceeded |
87 |
Execution timed out |
1064 ms |
12616 KB |
Time limit exceeded |
88 |
Execution timed out |
1065 ms |
12616 KB |
Time limit exceeded |
89 |
Execution timed out |
1072 ms |
12472 KB |
Time limit exceeded |
90 |
Execution timed out |
1062 ms |
11336 KB |
Time limit exceeded |
91 |
Execution timed out |
1076 ms |
12616 KB |
Time limit exceeded |
92 |
Execution timed out |
1068 ms |
12480 KB |
Time limit exceeded |
93 |
Execution timed out |
1041 ms |
12616 KB |
Time limit exceeded |
94 |
Execution timed out |
1067 ms |
12472 KB |
Time limit exceeded |
95 |
Execution timed out |
1065 ms |
12616 KB |
Time limit exceeded |
96 |
Execution timed out |
1066 ms |
12476 KB |
Time limit exceeded |
97 |
Execution timed out |
1067 ms |
12616 KB |
Time limit exceeded |
98 |
Execution timed out |
1071 ms |
12616 KB |
Time limit exceeded |
99 |
Execution timed out |
1073 ms |
12616 KB |
Time limit exceeded |
100 |
Execution timed out |
1069 ms |
12472 KB |
Time limit exceeded |