#include <algorithm>
#include <cassert>
#include <cstring>
#include <deque>
#include <ios>
#include <iostream>
#include <map>
#include <vector>
#define ll long long
#define ull unsigned ll
#define ld long double
#define ff first
#define ss second
#define ln "\n"
#define pll pair<ll, ll>
using namespace std;
void solve(){
ll n, m; cin >> n >> m;
vector<vector<ll>> a(n, vector<ll>(m));
for (ll i=0; i<n; i++) for (ll j=0; j<m; j++) {
char x; cin >> x;
a[i][j]=x-'0';
}
ll w=2e18, h=2e18;
for (ll i=0; i<n; i++){
ll cc=0;
for (ll j=0; j<m; j++){
if (a[i][j]==1){
cc++;
}else {
if (cc) h=min(h, cc);
cc=0;
}
}
if (cc) h=min(h, cc);
}
for (ll j=0; j<m; j++){
ll cc=0;
for (ll i=0; i<n; i++){
if (a[i][j]==1){
cc++;
}else {
if (cc) w=min(w, cc);
cc=0;
}
}
if (cc) w=min(w, cc);
}
cout << h*w << ln;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
ll t=1;
// cin >> t;
while (t--)solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
452 KB |
Output is correct |
8 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
19 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
20 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
21 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
22 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
23 |
Incorrect |
0 ms |
460 KB |
Output isn't correct |
24 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
25 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
26 |
Correct |
0 ms |
344 KB |
Output is correct |
27 |
Correct |
1 ms |
1116 KB |
Output is correct |
28 |
Incorrect |
2 ms |
1452 KB |
Output isn't correct |
29 |
Incorrect |
2 ms |
1580 KB |
Output isn't correct |
30 |
Incorrect |
3 ms |
1884 KB |
Output isn't correct |
31 |
Incorrect |
2 ms |
1628 KB |
Output isn't correct |
32 |
Incorrect |
3 ms |
1884 KB |
Output isn't correct |
33 |
Incorrect |
4 ms |
2140 KB |
Output isn't correct |
34 |
Incorrect |
1 ms |
1116 KB |
Output isn't correct |
35 |
Incorrect |
3 ms |
2140 KB |
Output isn't correct |
36 |
Correct |
3 ms |
2264 KB |
Output is correct |
37 |
Incorrect |
0 ms |
452 KB |
Output isn't correct |
38 |
Correct |
112 ms |
55608 KB |
Output is correct |
39 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
40 |
Incorrect |
10 ms |
7288 KB |
Output isn't correct |
41 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
42 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
43 |
Correct |
105 ms |
55352 KB |
Output is correct |
44 |
Incorrect |
3 ms |
2140 KB |
Output isn't correct |
45 |
Incorrect |
105 ms |
55380 KB |
Output isn't correct |
46 |
Correct |
115 ms |
55636 KB |
Output is correct |
47 |
Incorrect |
105 ms |
55376 KB |
Output isn't correct |
48 |
Incorrect |
107 ms |
55376 KB |
Output isn't correct |
49 |
Correct |
107 ms |
55352 KB |
Output is correct |
50 |
Incorrect |
113 ms |
55380 KB |
Output isn't correct |
51 |
Incorrect |
107 ms |
55380 KB |
Output isn't correct |
52 |
Incorrect |
106 ms |
55596 KB |
Output isn't correct |
53 |
Incorrect |
108 ms |
55480 KB |
Output isn't correct |
54 |
Incorrect |
110 ms |
55692 KB |
Output isn't correct |
55 |
Incorrect |
109 ms |
55380 KB |
Output isn't correct |
56 |
Correct |
104 ms |
55380 KB |
Output is correct |
57 |
Incorrect |
108 ms |
55364 KB |
Output isn't correct |
58 |
Incorrect |
119 ms |
55636 KB |
Output isn't correct |
59 |
Incorrect |
106 ms |
55376 KB |
Output isn't correct |
60 |
Correct |
106 ms |
55380 KB |
Output is correct |
61 |
Correct |
107 ms |
55340 KB |
Output is correct |
62 |
Correct |
108 ms |
55376 KB |
Output is correct |
63 |
Correct |
109 ms |
55376 KB |
Output is correct |
64 |
Correct |
114 ms |
55360 KB |
Output is correct |
65 |
Incorrect |
129 ms |
55384 KB |
Output isn't correct |
66 |
Incorrect |
110 ms |
55356 KB |
Output isn't correct |
67 |
Incorrect |
109 ms |
55748 KB |
Output isn't correct |
68 |
Incorrect |
102 ms |
55480 KB |
Output isn't correct |
69 |
Incorrect |
105 ms |
55380 KB |
Output isn't correct |
70 |
Incorrect |
81 ms |
35540 KB |
Output isn't correct |
71 |
Incorrect |
100 ms |
55376 KB |
Output isn't correct |
72 |
Incorrect |
113 ms |
55488 KB |
Output isn't correct |
73 |
Incorrect |
105 ms |
55376 KB |
Output isn't correct |
74 |
Incorrect |
134 ms |
55356 KB |
Output isn't correct |
75 |
Incorrect |
104 ms |
55384 KB |
Output isn't correct |
76 |
Incorrect |
105 ms |
55380 KB |
Output isn't correct |
77 |
Incorrect |
107 ms |
55348 KB |
Output isn't correct |
78 |
Incorrect |
130 ms |
55380 KB |
Output isn't correct |
79 |
Incorrect |
108 ms |
55600 KB |
Output isn't correct |
80 |
Incorrect |
115 ms |
55380 KB |
Output isn't correct |
81 |
Incorrect |
102 ms |
55380 KB |
Output isn't correct |
82 |
Incorrect |
104 ms |
55476 KB |
Output isn't correct |
83 |
Incorrect |
108 ms |
55472 KB |
Output isn't correct |
84 |
Incorrect |
102 ms |
55376 KB |
Output isn't correct |
85 |
Incorrect |
130 ms |
55380 KB |
Output isn't correct |
86 |
Incorrect |
101 ms |
55376 KB |
Output isn't correct |
87 |
Incorrect |
100 ms |
55376 KB |
Output isn't correct |
88 |
Incorrect |
97 ms |
55380 KB |
Output isn't correct |
89 |
Incorrect |
100 ms |
55376 KB |
Output isn't correct |
90 |
Incorrect |
68 ms |
35664 KB |
Output isn't correct |
91 |
Incorrect |
100 ms |
55384 KB |
Output isn't correct |
92 |
Incorrect |
100 ms |
55380 KB |
Output isn't correct |
93 |
Incorrect |
99 ms |
55376 KB |
Output isn't correct |
94 |
Incorrect |
102 ms |
55380 KB |
Output isn't correct |
95 |
Incorrect |
119 ms |
55380 KB |
Output isn't correct |
96 |
Incorrect |
103 ms |
55376 KB |
Output isn't correct |
97 |
Incorrect |
107 ms |
55380 KB |
Output isn't correct |
98 |
Incorrect |
102 ms |
55356 KB |
Output isn't correct |
99 |
Incorrect |
102 ms |
55376 KB |
Output isn't correct |
100 |
Incorrect |
101 ms |
55464 KB |
Output isn't correct |