#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define int long long
#define in insert
#define mid (l+r)/2
#define in insert
using namespace std;
const int N=2505;
char b[N][N];
int n,m;
int32_t main(){
ios::sync_with_stdio(false);cin.tie(nullptr);
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>b[i][j];
}
}
int h=n,w=m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(b[i][j]=='1'){
int cnt=1;
while(j+1<=m && b[i][j+1]=='1'){
++cnt;
++j;
}
w=min(w,cnt);
}
}
}
for(int j=1;j<=m;j++){
for(int i=1;i<=n;i++){
if(b[i][j]=='1'){
int cnt=1;
while(i+1<=n && b[i+1][j]=='1'){
++i;
++cnt;
}
h=min(h,cnt);
}
}
}
cout<<h*w;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
480 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
6 ms |
6488 KB |
Output is correct |
4 |
Correct |
6 ms |
6488 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
532 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
508 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
13 |
Correct |
2 ms |
352 KB |
Output is correct |
14 |
Correct |
1 ms |
608 KB |
Output is correct |
15 |
Incorrect |
1 ms |
352 KB |
Output isn't correct |
16 |
Correct |
1 ms |
352 KB |
Output is correct |
17 |
Correct |
2 ms |
484 KB |
Output is correct |
18 |
Incorrect |
2 ms |
608 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
608 KB |
Output isn't correct |
20 |
Incorrect |
2 ms |
640 KB |
Output isn't correct |
21 |
Incorrect |
2 ms |
608 KB |
Output isn't correct |
22 |
Incorrect |
2 ms |
608 KB |
Output isn't correct |
23 |
Incorrect |
2 ms |
608 KB |
Output isn't correct |
24 |
Incorrect |
2 ms |
608 KB |
Output isn't correct |
25 |
Incorrect |
2 ms |
608 KB |
Output isn't correct |
26 |
Correct |
1 ms |
596 KB |
Output is correct |
27 |
Correct |
2 ms |
1128 KB |
Output is correct |
28 |
Incorrect |
3 ms |
1112 KB |
Output isn't correct |
29 |
Incorrect |
4 ms |
1312 KB |
Output isn't correct |
30 |
Incorrect |
3 ms |
1620 KB |
Output isn't correct |
31 |
Incorrect |
3 ms |
1364 KB |
Output isn't correct |
32 |
Incorrect |
3 ms |
1620 KB |
Output isn't correct |
33 |
Incorrect |
4 ms |
1620 KB |
Output isn't correct |
34 |
Incorrect |
3 ms |
1376 KB |
Output isn't correct |
35 |
Incorrect |
5 ms |
1700 KB |
Output isn't correct |
36 |
Correct |
5 ms |
1620 KB |
Output is correct |
37 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
38 |
Correct |
67 ms |
12520 KB |
Output is correct |
39 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
40 |
Incorrect |
18 ms |
3156 KB |
Output isn't correct |
41 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
42 |
Incorrect |
1 ms |
552 KB |
Output isn't correct |
43 |
Correct |
110 ms |
12620 KB |
Output is correct |
44 |
Incorrect |
4 ms |
1784 KB |
Output isn't correct |
45 |
Incorrect |
75 ms |
12484 KB |
Output isn't correct |
46 |
Correct |
82 ms |
12480 KB |
Output is correct |
47 |
Incorrect |
78 ms |
12572 KB |
Output isn't correct |
48 |
Incorrect |
82 ms |
12620 KB |
Output isn't correct |
49 |
Correct |
90 ms |
12604 KB |
Output is correct |
50 |
Incorrect |
103 ms |
12620 KB |
Output isn't correct |
51 |
Incorrect |
131 ms |
12620 KB |
Output isn't correct |
52 |
Incorrect |
89 ms |
12620 KB |
Output isn't correct |
53 |
Incorrect |
87 ms |
12552 KB |
Output isn't correct |
54 |
Incorrect |
66 ms |
12620 KB |
Output isn't correct |
55 |
Incorrect |
81 ms |
12620 KB |
Output isn't correct |
56 |
Correct |
86 ms |
12616 KB |
Output is correct |
57 |
Incorrect |
70 ms |
12552 KB |
Output isn't correct |
58 |
Incorrect |
85 ms |
12620 KB |
Output isn't correct |
59 |
Incorrect |
98 ms |
12496 KB |
Output isn't correct |
60 |
Correct |
74 ms |
12504 KB |
Output is correct |
61 |
Correct |
105 ms |
12560 KB |
Output is correct |
62 |
Correct |
82 ms |
12620 KB |
Output is correct |
63 |
Correct |
82 ms |
12600 KB |
Output is correct |
64 |
Correct |
73 ms |
12552 KB |
Output is correct |
65 |
Incorrect |
90 ms |
12484 KB |
Output isn't correct |
66 |
Incorrect |
85 ms |
12572 KB |
Output isn't correct |
67 |
Incorrect |
91 ms |
12496 KB |
Output isn't correct |
68 |
Incorrect |
90 ms |
12620 KB |
Output isn't correct |
69 |
Incorrect |
73 ms |
12568 KB |
Output isn't correct |
70 |
Incorrect |
53 ms |
9036 KB |
Output isn't correct |
71 |
Incorrect |
71 ms |
12532 KB |
Output isn't correct |
72 |
Incorrect |
87 ms |
12472 KB |
Output isn't correct |
73 |
Incorrect |
72 ms |
12512 KB |
Output isn't correct |
74 |
Incorrect |
76 ms |
12520 KB |
Output isn't correct |
75 |
Incorrect |
90 ms |
12620 KB |
Output isn't correct |
76 |
Incorrect |
71 ms |
12524 KB |
Output isn't correct |
77 |
Incorrect |
84 ms |
12552 KB |
Output isn't correct |
78 |
Incorrect |
69 ms |
12616 KB |
Output isn't correct |
79 |
Incorrect |
87 ms |
12460 KB |
Output isn't correct |
80 |
Incorrect |
88 ms |
12484 KB |
Output isn't correct |
81 |
Incorrect |
85 ms |
12620 KB |
Output isn't correct |
82 |
Incorrect |
65 ms |
12620 KB |
Output isn't correct |
83 |
Incorrect |
84 ms |
12620 KB |
Output isn't correct |
84 |
Incorrect |
75 ms |
12492 KB |
Output isn't correct |
85 |
Incorrect |
73 ms |
12524 KB |
Output isn't correct |
86 |
Incorrect |
71 ms |
12624 KB |
Output isn't correct |
87 |
Incorrect |
76 ms |
12468 KB |
Output isn't correct |
88 |
Incorrect |
66 ms |
12620 KB |
Output isn't correct |
89 |
Incorrect |
83 ms |
12572 KB |
Output isn't correct |
90 |
Incorrect |
60 ms |
9036 KB |
Output isn't correct |
91 |
Incorrect |
89 ms |
12620 KB |
Output isn't correct |
92 |
Incorrect |
81 ms |
12620 KB |
Output isn't correct |
93 |
Incorrect |
79 ms |
12536 KB |
Output isn't correct |
94 |
Incorrect |
69 ms |
12616 KB |
Output isn't correct |
95 |
Incorrect |
62 ms |
12484 KB |
Output isn't correct |
96 |
Incorrect |
100 ms |
12364 KB |
Output isn't correct |
97 |
Incorrect |
106 ms |
12540 KB |
Output isn't correct |
98 |
Incorrect |
74 ms |
12636 KB |
Output isn't correct |
99 |
Incorrect |
87 ms |
12540 KB |
Output isn't correct |
100 |
Incorrect |
70 ms |
12500 KB |
Output isn't correct |