/******************************************************************************
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(jarak, 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++){
if(markas[i][j] == 1 && markas[i - 1][j] == 0 && markas[i][j - 1] == 0){
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;
}
if(markas[i][j] == 1 && markas[i + 1][j] == 0 && markas[i][j + 1] == 0){
int k = i;
int curP = jarak[k][j];
while(curP != 0){
if(mn[i - k + 1] == -1){
mn[i - k + 1] = curP;
}else{
mn[i - k + 1] = min(mn[i - k + 1], curP);
}
k--;
curP = min(curP, jarak[k][j]);
}
mn[i - k + 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 |
14 ms |
35540 KB |
Output isn't correct |
2 |
Incorrect |
13 ms |
35668 KB |
Output isn't correct |
3 |
Incorrect |
22 ms |
55636 KB |
Output isn't correct |
4 |
Incorrect |
22 ms |
55636 KB |
Output isn't correct |
5 |
Incorrect |
13 ms |
35540 KB |
Output isn't correct |
6 |
Incorrect |
13 ms |
35540 KB |
Output isn't correct |
7 |
Incorrect |
13 ms |
35540 KB |
Output isn't correct |
8 |
Incorrect |
13 ms |
35656 KB |
Output isn't correct |
9 |
Incorrect |
14 ms |
35652 KB |
Output isn't correct |
10 |
Incorrect |
13 ms |
35560 KB |
Output isn't correct |
11 |
Incorrect |
13 ms |
35668 KB |
Output isn't correct |
12 |
Incorrect |
13 ms |
35668 KB |
Output isn't correct |
13 |
Incorrect |
15 ms |
35728 KB |
Output isn't correct |
14 |
Incorrect |
14 ms |
35668 KB |
Output isn't correct |
15 |
Incorrect |
13 ms |
35668 KB |
Output isn't correct |
16 |
Incorrect |
13 ms |
35668 KB |
Output isn't correct |
17 |
Incorrect |
13 ms |
36100 KB |
Output isn't correct |
18 |
Incorrect |
14 ms |
36052 KB |
Output isn't correct |
19 |
Incorrect |
14 ms |
36308 KB |
Output isn't correct |
20 |
Incorrect |
14 ms |
36308 KB |
Output isn't correct |
21 |
Incorrect |
13 ms |
35924 KB |
Output isn't correct |
22 |
Incorrect |
14 ms |
36200 KB |
Output isn't correct |
23 |
Incorrect |
14 ms |
36388 KB |
Output isn't correct |
24 |
Incorrect |
14 ms |
36180 KB |
Output isn't correct |
25 |
Incorrect |
14 ms |
36436 KB |
Output isn't correct |
26 |
Incorrect |
14 ms |
36352 KB |
Output isn't correct |
27 |
Incorrect |
15 ms |
38484 KB |
Output isn't correct |
28 |
Incorrect |
15 ms |
38740 KB |
Output isn't correct |
29 |
Incorrect |
17 ms |
39636 KB |
Output isn't correct |
30 |
Incorrect |
17 ms |
40404 KB |
Output isn't correct |
31 |
Incorrect |
16 ms |
39380 KB |
Output isn't correct |
32 |
Incorrect |
16 ms |
40020 KB |
Output isn't correct |
33 |
Incorrect |
20 ms |
40660 KB |
Output isn't correct |
34 |
Incorrect |
16 ms |
38996 KB |
Output isn't correct |
35 |
Incorrect |
16 ms |
40660 KB |
Output isn't correct |
36 |
Incorrect |
17 ms |
40660 KB |
Output isn't correct |
37 |
Incorrect |
13 ms |
35668 KB |
Output isn't correct |
38 |
Incorrect |
85 ms |
94276 KB |
Output isn't correct |
39 |
Incorrect |
13 ms |
35668 KB |
Output isn't correct |
40 |
Incorrect |
25 ms |
48592 KB |
Output isn't correct |
41 |
Incorrect |
14 ms |
35668 KB |
Output isn't correct |
42 |
Incorrect |
14 ms |
36436 KB |
Output isn't correct |
43 |
Incorrect |
86 ms |
94284 KB |
Output isn't correct |
44 |
Incorrect |
17 ms |
40720 KB |
Output isn't correct |
45 |
Incorrect |
81 ms |
94284 KB |
Output isn't correct |
46 |
Incorrect |
74 ms |
94220 KB |
Output isn't correct |
47 |
Incorrect |
83 ms |
94412 KB |
Output isn't correct |
48 |
Incorrect |
75 ms |
94276 KB |
Output isn't correct |
49 |
Incorrect |
82 ms |
94284 KB |
Output isn't correct |
50 |
Incorrect |
75 ms |
94196 KB |
Output isn't correct |
51 |
Incorrect |
75 ms |
94316 KB |
Output isn't correct |
52 |
Incorrect |
75 ms |
94280 KB |
Output isn't correct |
53 |
Incorrect |
72 ms |
94284 KB |
Output isn't correct |
54 |
Incorrect |
73 ms |
94288 KB |
Output isn't correct |
55 |
Incorrect |
66 ms |
94284 KB |
Output isn't correct |
56 |
Incorrect |
82 ms |
94304 KB |
Output isn't correct |
57 |
Incorrect |
66 ms |
94284 KB |
Output isn't correct |
58 |
Incorrect |
68 ms |
94208 KB |
Output isn't correct |
59 |
Incorrect |
65 ms |
94260 KB |
Output isn't correct |
60 |
Incorrect |
70 ms |
94216 KB |
Output isn't correct |
61 |
Incorrect |
82 ms |
94260 KB |
Output isn't correct |
62 |
Incorrect |
81 ms |
94252 KB |
Output isn't correct |
63 |
Incorrect |
81 ms |
94216 KB |
Output isn't correct |
64 |
Incorrect |
66 ms |
94220 KB |
Output isn't correct |
65 |
Incorrect |
72 ms |
94284 KB |
Output isn't correct |
66 |
Incorrect |
70 ms |
94216 KB |
Output isn't correct |
67 |
Incorrect |
73 ms |
94272 KB |
Output isn't correct |
68 |
Incorrect |
79 ms |
94260 KB |
Output isn't correct |
69 |
Incorrect |
66 ms |
94204 KB |
Output isn't correct |
70 |
Incorrect |
46 ms |
82508 KB |
Output isn't correct |
71 |
Incorrect |
63 ms |
94284 KB |
Output isn't correct |
72 |
Incorrect |
67 ms |
94276 KB |
Output isn't correct |
73 |
Incorrect |
66 ms |
94284 KB |
Output isn't correct |
74 |
Incorrect |
64 ms |
94300 KB |
Output isn't correct |
75 |
Incorrect |
64 ms |
94284 KB |
Output isn't correct |
76 |
Incorrect |
66 ms |
94284 KB |
Output isn't correct |
77 |
Incorrect |
67 ms |
94248 KB |
Output isn't correct |
78 |
Incorrect |
65 ms |
94304 KB |
Output isn't correct |
79 |
Incorrect |
58 ms |
94300 KB |
Output isn't correct |
80 |
Incorrect |
56 ms |
94232 KB |
Output isn't correct |
81 |
Incorrect |
58 ms |
94268 KB |
Output isn't correct |
82 |
Incorrect |
67 ms |
94284 KB |
Output isn't correct |
83 |
Incorrect |
66 ms |
94204 KB |
Output isn't correct |
84 |
Incorrect |
58 ms |
94304 KB |
Output isn't correct |
85 |
Incorrect |
65 ms |
94284 KB |
Output isn't correct |
86 |
Incorrect |
80 ms |
94280 KB |
Output isn't correct |
87 |
Incorrect |
64 ms |
94284 KB |
Output isn't correct |
88 |
Incorrect |
67 ms |
94180 KB |
Output isn't correct |
89 |
Incorrect |
70 ms |
94180 KB |
Output isn't correct |
90 |
Incorrect |
51 ms |
82492 KB |
Output isn't correct |
91 |
Incorrect |
67 ms |
94264 KB |
Output isn't correct |
92 |
Incorrect |
73 ms |
94304 KB |
Output isn't correct |
93 |
Incorrect |
88 ms |
94284 KB |
Output isn't correct |
94 |
Incorrect |
72 ms |
94300 KB |
Output isn't correct |
95 |
Incorrect |
65 ms |
94284 KB |
Output isn't correct |
96 |
Incorrect |
68 ms |
94180 KB |
Output isn't correct |
97 |
Incorrect |
80 ms |
94284 KB |
Output isn't correct |
98 |
Incorrect |
78 ms |
94188 KB |
Output isn't correct |
99 |
Incorrect |
71 ms |
94216 KB |
Output isn't correct |
100 |
Incorrect |
79 ms |
94284 KB |
Output isn't correct |