#include<bits/stdc++.h>
#define STIZE(x) fprintf(stderr, "STIZE%d\n", x);
#define PRINT(x) fprintf(stderr, "%s = %d\n", #x, x);
#define NL(x) printf("%c", " \n"[(x)]);
#define lld long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mid (l+r)/2
#define endl '\n'
#define all(a) begin(a),end(a)
#define sz(a) int((a).size())
#define LINF 1000000000000000LL
#define INF 1000000000
#define EPS 1e-9
using namespace std;
string s[2510];
int N, M;
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cerr.tie(0);
cin >> N >> M;
s[0] = string(M+2, '0');
for(int i = 1; i <= N; i++) {
cin >> s[i];
s[i] = '0' + s[i] + '0';
}
s[N+1] = string(M+2, '0');
int cur = 0, najmX = INF, najmY = INF;
for(int i = 1; i <= N; i++) {
for(int j = 1; j <= M+1; j++) {
if(s[i][j] == '1') cur++;
if(s[i][j] == '0' && s[i][j-1] == '1') najmX = min(najmX, cur);
if(s[i][j] == '0') cur = 0;
}
}
cur = 0;
for(int j = 1; j <= M; j++) {
for(int i = 1; i <= N+1; i++) {
if(s[i][j] == '1') cur++;
if(s[i][j] == '0' && s[i-1][j] == '1') najmY = min(najmY, cur);
if(s[i][j] == '0') cur = 0;
}
}
cout << najmX*najmY;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
504 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
504 KB |
Output is correct |
18 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
19 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
20 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
21 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
22 |
Incorrect |
2 ms |
508 KB |
Output isn't correct |
23 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
24 |
Incorrect |
2 ms |
508 KB |
Output isn't correct |
25 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
26 |
Correct |
2 ms |
504 KB |
Output is correct |
27 |
Correct |
3 ms |
636 KB |
Output is correct |
28 |
Incorrect |
3 ms |
760 KB |
Output isn't correct |
29 |
Incorrect |
4 ms |
808 KB |
Output isn't correct |
30 |
Incorrect |
4 ms |
888 KB |
Output isn't correct |
31 |
Incorrect |
4 ms |
892 KB |
Output isn't correct |
32 |
Incorrect |
3 ms |
888 KB |
Output isn't correct |
33 |
Incorrect |
5 ms |
1016 KB |
Output isn't correct |
34 |
Incorrect |
3 ms |
632 KB |
Output isn't correct |
35 |
Incorrect |
4 ms |
1016 KB |
Output isn't correct |
36 |
Correct |
4 ms |
1016 KB |
Output is correct |
37 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
38 |
Correct |
75 ms |
18908 KB |
Output is correct |
39 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
40 |
Incorrect |
8 ms |
2680 KB |
Output isn't correct |
41 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
42 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
43 |
Correct |
77 ms |
18864 KB |
Output is correct |
44 |
Incorrect |
4 ms |
1064 KB |
Output isn't correct |
45 |
Incorrect |
76 ms |
18752 KB |
Output isn't correct |
46 |
Correct |
85 ms |
18780 KB |
Output is correct |
47 |
Incorrect |
76 ms |
18868 KB |
Output isn't correct |
48 |
Incorrect |
76 ms |
18812 KB |
Output isn't correct |
49 |
Correct |
82 ms |
18808 KB |
Output is correct |
50 |
Incorrect |
78 ms |
18808 KB |
Output isn't correct |
51 |
Incorrect |
95 ms |
18896 KB |
Output isn't correct |
52 |
Incorrect |
78 ms |
18808 KB |
Output isn't correct |
53 |
Incorrect |
97 ms |
18808 KB |
Output isn't correct |
54 |
Incorrect |
79 ms |
18808 KB |
Output isn't correct |
55 |
Incorrect |
110 ms |
18936 KB |
Output isn't correct |
56 |
Correct |
84 ms |
18808 KB |
Output is correct |
57 |
Incorrect |
86 ms |
18808 KB |
Output isn't correct |
58 |
Incorrect |
86 ms |
18812 KB |
Output isn't correct |
59 |
Incorrect |
84 ms |
18808 KB |
Output isn't correct |
60 |
Correct |
112 ms |
18808 KB |
Output is correct |
61 |
Correct |
83 ms |
18808 KB |
Output is correct |
62 |
Correct |
76 ms |
18868 KB |
Output is correct |
63 |
Correct |
77 ms |
18808 KB |
Output is correct |
64 |
Correct |
77 ms |
18808 KB |
Output is correct |
65 |
Incorrect |
77 ms |
18808 KB |
Output isn't correct |
66 |
Incorrect |
76 ms |
18852 KB |
Output isn't correct |
67 |
Incorrect |
78 ms |
18936 KB |
Output isn't correct |
68 |
Incorrect |
78 ms |
18808 KB |
Output isn't correct |
69 |
Incorrect |
78 ms |
18768 KB |
Output isn't correct |
70 |
Incorrect |
44 ms |
12156 KB |
Output isn't correct |
71 |
Incorrect |
77 ms |
18804 KB |
Output isn't correct |
72 |
Incorrect |
81 ms |
18808 KB |
Output isn't correct |
73 |
Incorrect |
77 ms |
18860 KB |
Output isn't correct |
74 |
Incorrect |
87 ms |
18892 KB |
Output isn't correct |
75 |
Incorrect |
79 ms |
18808 KB |
Output isn't correct |
76 |
Incorrect |
76 ms |
18816 KB |
Output isn't correct |
77 |
Incorrect |
80 ms |
18808 KB |
Output isn't correct |
78 |
Incorrect |
78 ms |
18808 KB |
Output isn't correct |
79 |
Incorrect |
80 ms |
18808 KB |
Output isn't correct |
80 |
Incorrect |
78 ms |
18808 KB |
Output isn't correct |
81 |
Incorrect |
80 ms |
18936 KB |
Output isn't correct |
82 |
Incorrect |
79 ms |
18872 KB |
Output isn't correct |
83 |
Incorrect |
76 ms |
18936 KB |
Output isn't correct |
84 |
Incorrect |
80 ms |
18936 KB |
Output isn't correct |
85 |
Incorrect |
83 ms |
18912 KB |
Output isn't correct |
86 |
Incorrect |
77 ms |
18904 KB |
Output isn't correct |
87 |
Incorrect |
79 ms |
18808 KB |
Output isn't correct |
88 |
Incorrect |
79 ms |
18808 KB |
Output isn't correct |
89 |
Incorrect |
77 ms |
18808 KB |
Output isn't correct |
90 |
Incorrect |
44 ms |
12152 KB |
Output isn't correct |
91 |
Incorrect |
80 ms |
18808 KB |
Output isn't correct |
92 |
Incorrect |
78 ms |
18808 KB |
Output isn't correct |
93 |
Incorrect |
75 ms |
18808 KB |
Output isn't correct |
94 |
Incorrect |
84 ms |
18936 KB |
Output isn't correct |
95 |
Incorrect |
78 ms |
18764 KB |
Output isn't correct |
96 |
Incorrect |
76 ms |
18872 KB |
Output isn't correct |
97 |
Incorrect |
75 ms |
18808 KB |
Output isn't correct |
98 |
Incorrect |
82 ms |
18872 KB |
Output isn't correct |
99 |
Incorrect |
78 ms |
18808 KB |
Output isn't correct |
100 |
Incorrect |
77 ms |
18808 KB |
Output isn't correct |