/******************************************************************************
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];
bool ada = true;
int mn[N];
int mx = 0;
void solve(){
int n, m;
cin >> n >> m;
memset(jarak, 0, sizeof(jarak));
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++){
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(jarak[k][j] != 0){
k++;
if(jarak[k][j] < curP){
if(mn[curP] == -1){
mn[curP] = k - i;
}else{
mn[curP] = min(mn[curP], k - i);
}
curP = jarak[k][j];
}
}
if(mn[curP] == -1){
mn[curP] = k - i;
}else{
mn[curP] = min(mn[curP], k - i);
}
}
}
}
for(int i = mnPjg; i >= 0; i--){
if(mn[i] == -1){
mn[i] = mn[i + 1];
}
}
for(int i = 1; i <= mnPjg; i++){
mn[i] = min(mn[i], mn[i - 1]);
mx = max(mx, mn[i]*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 |
Correct |
13 ms |
35588 KB |
Output is correct |
2 |
Correct |
13 ms |
35540 KB |
Output is correct |
3 |
Correct |
16 ms |
45524 KB |
Output is correct |
4 |
Correct |
17 ms |
45524 KB |
Output is correct |
5 |
Correct |
13 ms |
35540 KB |
Output is correct |
6 |
Correct |
17 ms |
35584 KB |
Output is correct |
7 |
Incorrect |
13 ms |
35472 KB |
Output isn't correct |
8 |
Incorrect |
13 ms |
35540 KB |
Output isn't correct |
9 |
Incorrect |
13 ms |
35540 KB |
Output isn't correct |
10 |
Incorrect |
13 ms |
35540 KB |
Output isn't correct |
11 |
Incorrect |
12 ms |
35540 KB |
Output isn't correct |
12 |
Incorrect |
13 ms |
35596 KB |
Output isn't correct |
13 |
Incorrect |
14 ms |
35540 KB |
Output isn't correct |
14 |
Correct |
14 ms |
35540 KB |
Output is correct |
15 |
Incorrect |
13 ms |
35540 KB |
Output isn't correct |
16 |
Correct |
13 ms |
35540 KB |
Output is correct |
17 |
Correct |
14 ms |
35796 KB |
Output is correct |
18 |
Incorrect |
13 ms |
35796 KB |
Output isn't correct |
19 |
Incorrect |
14 ms |
35924 KB |
Output isn't correct |
20 |
Incorrect |
14 ms |
35924 KB |
Output isn't correct |
21 |
Incorrect |
13 ms |
35796 KB |
Output isn't correct |
22 |
Incorrect |
14 ms |
35840 KB |
Output isn't correct |
23 |
Incorrect |
14 ms |
35924 KB |
Output isn't correct |
24 |
Incorrect |
16 ms |
35796 KB |
Output isn't correct |
25 |
Incorrect |
14 ms |
35924 KB |
Output isn't correct |
26 |
Incorrect |
16 ms |
36036 KB |
Output isn't correct |
27 |
Incorrect |
14 ms |
36948 KB |
Output isn't correct |
28 |
Incorrect |
14 ms |
37076 KB |
Output isn't correct |
29 |
Incorrect |
14 ms |
37588 KB |
Output isn't correct |
30 |
Incorrect |
14 ms |
37972 KB |
Output isn't correct |
31 |
Incorrect |
15 ms |
37452 KB |
Output isn't correct |
32 |
Incorrect |
17 ms |
37768 KB |
Output isn't correct |
33 |
Incorrect |
14 ms |
38100 KB |
Output isn't correct |
34 |
Incorrect |
14 ms |
37204 KB |
Output isn't correct |
35 |
Incorrect |
15 ms |
38100 KB |
Output isn't correct |
36 |
Incorrect |
15 ms |
38100 KB |
Output isn't correct |
37 |
Incorrect |
14 ms |
35540 KB |
Output isn't correct |
38 |
Correct |
52 ms |
64944 KB |
Output is correct |
39 |
Incorrect |
13 ms |
35540 KB |
Output isn't correct |
40 |
Incorrect |
19 ms |
42068 KB |
Output isn't correct |
41 |
Incorrect |
13 ms |
35540 KB |
Output isn't correct |
42 |
Incorrect |
13 ms |
35924 KB |
Output isn't correct |
43 |
Incorrect |
52 ms |
65004 KB |
Output isn't correct |
44 |
Incorrect |
15 ms |
38100 KB |
Output isn't correct |
45 |
Incorrect |
52 ms |
64836 KB |
Output isn't correct |
46 |
Correct |
48 ms |
64940 KB |
Output is correct |
47 |
Incorrect |
52 ms |
64944 KB |
Output isn't correct |
48 |
Incorrect |
52 ms |
64852 KB |
Output isn't correct |
49 |
Incorrect |
51 ms |
64940 KB |
Output isn't correct |
50 |
Incorrect |
48 ms |
64844 KB |
Output isn't correct |
51 |
Incorrect |
54 ms |
64980 KB |
Output isn't correct |
52 |
Incorrect |
49 ms |
64852 KB |
Output isn't correct |
53 |
Incorrect |
48 ms |
64900 KB |
Output isn't correct |
54 |
Incorrect |
46 ms |
64940 KB |
Output isn't correct |
55 |
Incorrect |
47 ms |
64928 KB |
Output isn't correct |
56 |
Correct |
50 ms |
64948 KB |
Output is correct |
57 |
Incorrect |
45 ms |
64948 KB |
Output isn't correct |
58 |
Incorrect |
45 ms |
64844 KB |
Output isn't correct |
59 |
Incorrect |
45 ms |
64852 KB |
Output isn't correct |
60 |
Incorrect |
49 ms |
64852 KB |
Output isn't correct |
61 |
Incorrect |
52 ms |
64940 KB |
Output isn't correct |
62 |
Incorrect |
53 ms |
64844 KB |
Output isn't correct |
63 |
Incorrect |
52 ms |
64948 KB |
Output isn't correct |
64 |
Incorrect |
44 ms |
64852 KB |
Output isn't correct |
65 |
Incorrect |
47 ms |
64840 KB |
Output isn't correct |
66 |
Incorrect |
48 ms |
64844 KB |
Output isn't correct |
67 |
Incorrect |
48 ms |
64904 KB |
Output isn't correct |
68 |
Incorrect |
49 ms |
64844 KB |
Output isn't correct |
69 |
Incorrect |
45 ms |
64844 KB |
Output isn't correct |
70 |
Incorrect |
34 ms |
58964 KB |
Output isn't correct |
71 |
Incorrect |
43 ms |
64844 KB |
Output isn't correct |
72 |
Incorrect |
44 ms |
64940 KB |
Output isn't correct |
73 |
Incorrect |
46 ms |
64920 KB |
Output isn't correct |
74 |
Incorrect |
45 ms |
64852 KB |
Output isn't correct |
75 |
Incorrect |
46 ms |
64960 KB |
Output isn't correct |
76 |
Incorrect |
46 ms |
64852 KB |
Output isn't correct |
77 |
Incorrect |
44 ms |
64852 KB |
Output isn't correct |
78 |
Incorrect |
47 ms |
64940 KB |
Output isn't correct |
79 |
Incorrect |
45 ms |
64840 KB |
Output isn't correct |
80 |
Incorrect |
41 ms |
64844 KB |
Output isn't correct |
81 |
Incorrect |
43 ms |
64844 KB |
Output isn't correct |
82 |
Incorrect |
45 ms |
64844 KB |
Output isn't correct |
83 |
Incorrect |
45 ms |
64940 KB |
Output isn't correct |
84 |
Incorrect |
41 ms |
64852 KB |
Output isn't correct |
85 |
Incorrect |
44 ms |
64964 KB |
Output isn't correct |
86 |
Incorrect |
51 ms |
64944 KB |
Output isn't correct |
87 |
Incorrect |
44 ms |
64920 KB |
Output isn't correct |
88 |
Incorrect |
44 ms |
64844 KB |
Output isn't correct |
89 |
Incorrect |
47 ms |
64884 KB |
Output isn't correct |
90 |
Incorrect |
35 ms |
59092 KB |
Output isn't correct |
91 |
Incorrect |
46 ms |
64860 KB |
Output isn't correct |
92 |
Incorrect |
47 ms |
64852 KB |
Output isn't correct |
93 |
Incorrect |
51 ms |
64844 KB |
Output isn't correct |
94 |
Incorrect |
55 ms |
64844 KB |
Output isn't correct |
95 |
Incorrect |
48 ms |
64944 KB |
Output isn't correct |
96 |
Incorrect |
49 ms |
65100 KB |
Output isn't correct |
97 |
Incorrect |
52 ms |
64852 KB |
Output isn't correct |
98 |
Incorrect |
45 ms |
64944 KB |
Output isn't correct |
99 |
Incorrect |
47 ms |
64844 KB |
Output isn't correct |
100 |
Incorrect |
53 ms |
64944 KB |
Output isn't correct |