/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
const int N = 3e3;
int markas[N][N];
int jarak[N][N];
int jarakKiri[N][N];
bool ada = true;
int mn[N];
int mx = 0;
void solve(){
int n, m;
cin >> n >> m;
memset(jarak, 0, sizeof(jarak));
memset(jarakKiri, 0, sizeof(jarakKiri));
memset(mn, -1, sizeof(mn));
int mnPjg = n*m;
for(int i = 1; i <= n; i++){
string s;
cin >> s;
for(int j = 1; j <= m; j++){
markas[i][j] = s[j - 1] - '0';
}
}
for(int i = 1; i <= n; i++){
for(int j = m; j >= 1; j--){
jarak[i][j] = jarak[i][j + 1] + 1;
if(!markas[i][j]){
jarak[i][j] = 0;
}
}
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
jarakKiri[i][j] = jarakKiri[i][j - 1] + 1;
if(!markas[i][j]){
jarakKiri[i][j] = 0;
}
}
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
int k = i;
int curP = jarak[k][j];
mnPjg = min(mnPjg, curP);
while(curP != 0){
if(mn[k - i + 1] == -1){
mn[k - i + 1] = curP;
}else{
mn[k - i + 1] = min(mn[k - i + 1], curP);
}
k++;
curP = min(curP, jarak[k][j]);
}
mn[k - i + 1] = 0;
}
}
mx = mn[1];
for(int i = 2; i <= m; i++){
mn[i] = min(mn[i], mn[i - 1]);
mx = max(mx, i * mn[i]);
}
cout << mx << endl;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
t = 1;
while(t--){
solve();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
70680 KB |
Output isn't correct |
2 |
Incorrect |
24 ms |
70848 KB |
Output isn't correct |
3 |
Incorrect |
31 ms |
80780 KB |
Output isn't correct |
4 |
Incorrect |
29 ms |
80788 KB |
Output isn't correct |
5 |
Incorrect |
26 ms |
70784 KB |
Output isn't correct |
6 |
Incorrect |
24 ms |
70796 KB |
Output isn't correct |
7 |
Incorrect |
24 ms |
70692 KB |
Output isn't correct |
8 |
Incorrect |
24 ms |
70768 KB |
Output isn't correct |
9 |
Incorrect |
23 ms |
70776 KB |
Output isn't correct |
10 |
Incorrect |
23 ms |
70840 KB |
Output isn't correct |
11 |
Incorrect |
25 ms |
70844 KB |
Output isn't correct |
12 |
Incorrect |
25 ms |
70732 KB |
Output isn't correct |
13 |
Incorrect |
25 ms |
70812 KB |
Output isn't correct |
14 |
Incorrect |
25 ms |
70756 KB |
Output isn't correct |
15 |
Incorrect |
24 ms |
70808 KB |
Output isn't correct |
16 |
Incorrect |
24 ms |
70844 KB |
Output isn't correct |
17 |
Incorrect |
24 ms |
71048 KB |
Output isn't correct |
18 |
Incorrect |
24 ms |
71068 KB |
Output isn't correct |
19 |
Incorrect |
24 ms |
71160 KB |
Output isn't correct |
20 |
Incorrect |
24 ms |
71140 KB |
Output isn't correct |
21 |
Incorrect |
25 ms |
70912 KB |
Output isn't correct |
22 |
Incorrect |
24 ms |
71076 KB |
Output isn't correct |
23 |
Incorrect |
24 ms |
71192 KB |
Output isn't correct |
24 |
Incorrect |
23 ms |
71148 KB |
Output isn't correct |
25 |
Incorrect |
24 ms |
71088 KB |
Output isn't correct |
26 |
Incorrect |
25 ms |
71116 KB |
Output isn't correct |
27 |
Incorrect |
37 ms |
72188 KB |
Output isn't correct |
28 |
Incorrect |
27 ms |
72340 KB |
Output isn't correct |
29 |
Incorrect |
47 ms |
72788 KB |
Output isn't correct |
30 |
Incorrect |
30 ms |
73216 KB |
Output isn't correct |
31 |
Incorrect |
27 ms |
72624 KB |
Output isn't correct |
32 |
Incorrect |
29 ms |
73124 KB |
Output isn't correct |
33 |
Incorrect |
39 ms |
73288 KB |
Output isn't correct |
34 |
Incorrect |
26 ms |
72408 KB |
Output isn't correct |
35 |
Incorrect |
30 ms |
73308 KB |
Output isn't correct |
36 |
Incorrect |
87 ms |
73292 KB |
Output isn't correct |
37 |
Incorrect |
23 ms |
70868 KB |
Output isn't correct |
38 |
Execution timed out |
1088 ms |
100144 KB |
Time limit exceeded |
39 |
Incorrect |
25 ms |
70744 KB |
Output isn't correct |
40 |
Incorrect |
339 ms |
77328 KB |
Output isn't correct |
41 |
Incorrect |
24 ms |
70828 KB |
Output isn't correct |
42 |
Incorrect |
24 ms |
71116 KB |
Output isn't correct |
43 |
Execution timed out |
1080 ms |
100156 KB |
Time limit exceeded |
44 |
Incorrect |
51 ms |
73300 KB |
Output isn't correct |
45 |
Execution timed out |
1087 ms |
100044 KB |
Time limit exceeded |
46 |
Incorrect |
121 ms |
100188 KB |
Output isn't correct |
47 |
Execution timed out |
1099 ms |
100060 KB |
Time limit exceeded |
48 |
Execution timed out |
1090 ms |
100096 KB |
Time limit exceeded |
49 |
Execution timed out |
1082 ms |
100068 KB |
Time limit exceeded |
50 |
Execution timed out |
1095 ms |
100148 KB |
Time limit exceeded |
51 |
Execution timed out |
1090 ms |
100168 KB |
Time limit exceeded |
52 |
Execution timed out |
1079 ms |
100084 KB |
Time limit exceeded |
53 |
Execution timed out |
1091 ms |
100144 KB |
Time limit exceeded |
54 |
Execution timed out |
1092 ms |
100120 KB |
Time limit exceeded |
55 |
Execution timed out |
1097 ms |
100100 KB |
Time limit exceeded |
56 |
Execution timed out |
1090 ms |
100044 KB |
Time limit exceeded |
57 |
Execution timed out |
1087 ms |
100160 KB |
Time limit exceeded |
58 |
Execution timed out |
1089 ms |
100064 KB |
Time limit exceeded |
59 |
Execution timed out |
1094 ms |
100072 KB |
Time limit exceeded |
60 |
Execution timed out |
1086 ms |
100072 KB |
Time limit exceeded |
61 |
Execution timed out |
1088 ms |
100064 KB |
Time limit exceeded |
62 |
Execution timed out |
1081 ms |
100096 KB |
Time limit exceeded |
63 |
Execution timed out |
1090 ms |
100104 KB |
Time limit exceeded |
64 |
Execution timed out |
1087 ms |
100044 KB |
Time limit exceeded |
65 |
Execution timed out |
1090 ms |
100148 KB |
Time limit exceeded |
66 |
Execution timed out |
1080 ms |
100176 KB |
Time limit exceeded |
67 |
Execution timed out |
1082 ms |
100068 KB |
Time limit exceeded |
68 |
Execution timed out |
1070 ms |
100180 KB |
Time limit exceeded |
69 |
Execution timed out |
1085 ms |
100044 KB |
Time limit exceeded |
70 |
Incorrect |
194 ms |
94292 KB |
Output isn't correct |
71 |
Incorrect |
548 ms |
100164 KB |
Output isn't correct |
72 |
Incorrect |
888 ms |
100168 KB |
Output isn't correct |
73 |
Incorrect |
989 ms |
100172 KB |
Output isn't correct |
74 |
Incorrect |
940 ms |
100308 KB |
Output isn't correct |
75 |
Execution timed out |
1082 ms |
100044 KB |
Time limit exceeded |
76 |
Execution timed out |
1084 ms |
100084 KB |
Time limit exceeded |
77 |
Execution timed out |
1084 ms |
100100 KB |
Time limit exceeded |
78 |
Execution timed out |
1083 ms |
100044 KB |
Time limit exceeded |
79 |
Incorrect |
67 ms |
100156 KB |
Output isn't correct |
80 |
Incorrect |
68 ms |
100172 KB |
Output isn't correct |
81 |
Incorrect |
101 ms |
100076 KB |
Output isn't correct |
82 |
Execution timed out |
1085 ms |
100088 KB |
Time limit exceeded |
83 |
Execution timed out |
1088 ms |
100116 KB |
Time limit exceeded |
84 |
Incorrect |
66 ms |
100124 KB |
Output isn't correct |
85 |
Execution timed out |
1090 ms |
100156 KB |
Time limit exceeded |
86 |
Execution timed out |
1073 ms |
100104 KB |
Time limit exceeded |
87 |
Execution timed out |
1089 ms |
100044 KB |
Time limit exceeded |
88 |
Execution timed out |
1093 ms |
100104 KB |
Time limit exceeded |
89 |
Execution timed out |
1091 ms |
100044 KB |
Time limit exceeded |
90 |
Incorrect |
450 ms |
94384 KB |
Output isn't correct |
91 |
Execution timed out |
1096 ms |
100044 KB |
Time limit exceeded |
92 |
Execution timed out |
1091 ms |
100056 KB |
Time limit exceeded |
93 |
Execution timed out |
1086 ms |
100116 KB |
Time limit exceeded |
94 |
Execution timed out |
1075 ms |
100044 KB |
Time limit exceeded |
95 |
Execution timed out |
1080 ms |
100148 KB |
Time limit exceeded |
96 |
Execution timed out |
1081 ms |
100156 KB |
Time limit exceeded |
97 |
Execution timed out |
1089 ms |
100132 KB |
Time limit exceeded |
98 |
Execution timed out |
1085 ms |
100044 KB |
Time limit exceeded |
99 |
Execution timed out |
1086 ms |
100044 KB |
Time limit exceeded |
100 |
Execution timed out |
1084 ms |
100156 KB |
Time limit exceeded |