#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=3e3+50;
const int mod=1e9+7;
using namespace std;
int n,m,i,j,cur,h[nmax][nmax],v[nmax][nmax],x,y,a[nmax][nmax];
char c;
int main()
{
//freopen("sol.in","r",stdin);
//freopen("sol.out","w",stdout);
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
cin>>n>>m;
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
cin>>c;
a[i][j]=(c=='1');
}
}
x=y=inf;
for(i=1;i<=n;i++)
{
for(j=m;j>=1;j--)
{
if(a[i][j])
{
h[i][j]=h[i][j+1]+1;
if(!a[i][j-1])y=min(y,h[i][j]);
}
}
}
for(i=1;i<=m;i++)
{
for(j=n;j>=1;j--)
{
if(a[j][i])
{
v[j][i]=v[j+1][i]+1;
if(!a[j-1][i])x=min(x,v[j][i]);
}
}
}
cout<<x*y<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
632 KB |
Output is correct |
3 |
Correct |
29 ms |
30456 KB |
Output is correct |
4 |
Correct |
29 ms |
30452 KB |
Output is correct |
5 |
Correct |
2 ms |
376 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 |
504 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
13 |
Correct |
2 ms |
504 KB |
Output is correct |
14 |
Correct |
2 ms |
504 KB |
Output is correct |
15 |
Incorrect |
2 ms |
632 KB |
Output isn't correct |
16 |
Correct |
2 ms |
632 KB |
Output is correct |
17 |
Correct |
3 ms |
1144 KB |
Output is correct |
18 |
Incorrect |
3 ms |
888 KB |
Output isn't correct |
19 |
Incorrect |
3 ms |
1272 KB |
Output isn't correct |
20 |
Incorrect |
3 ms |
1144 KB |
Output isn't correct |
21 |
Incorrect |
2 ms |
632 KB |
Output isn't correct |
22 |
Incorrect |
3 ms |
1016 KB |
Output isn't correct |
23 |
Incorrect |
3 ms |
1272 KB |
Output isn't correct |
24 |
Incorrect |
3 ms |
1144 KB |
Output isn't correct |
25 |
Incorrect |
3 ms |
1528 KB |
Output isn't correct |
26 |
Correct |
3 ms |
1728 KB |
Output is correct |
27 |
Correct |
7 ms |
4856 KB |
Output is correct |
28 |
Incorrect |
6 ms |
2424 KB |
Output isn't correct |
29 |
Incorrect |
10 ms |
6268 KB |
Output isn't correct |
30 |
Incorrect |
10 ms |
5752 KB |
Output isn't correct |
31 |
Incorrect |
8 ms |
4344 KB |
Output isn't correct |
32 |
Incorrect |
9 ms |
5500 KB |
Output isn't correct |
33 |
Incorrect |
12 ms |
6904 KB |
Output isn't correct |
34 |
Incorrect |
5 ms |
2680 KB |
Output isn't correct |
35 |
Incorrect |
8 ms |
3724 KB |
Output isn't correct |
36 |
Correct |
14 ms |
8312 KB |
Output is correct |
37 |
Incorrect |
2 ms |
632 KB |
Output isn't correct |
38 |
Correct |
370 ms |
95964 KB |
Output is correct |
39 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
40 |
Incorrect |
41 ms |
20600 KB |
Output isn't correct |
41 |
Incorrect |
2 ms |
632 KB |
Output isn't correct |
42 |
Incorrect |
4 ms |
1656 KB |
Output isn't correct |
43 |
Correct |
325 ms |
86648 KB |
Output is correct |
44 |
Incorrect |
13 ms |
7800 KB |
Output isn't correct |
45 |
Incorrect |
317 ms |
86072 KB |
Output isn't correct |
46 |
Correct |
304 ms |
95992 KB |
Output is correct |
47 |
Incorrect |
347 ms |
86088 KB |
Output isn't correct |
48 |
Incorrect |
310 ms |
95968 KB |
Output isn't correct |
49 |
Correct |
371 ms |
95976 KB |
Output is correct |
50 |
Incorrect |
316 ms |
95992 KB |
Output isn't correct |
51 |
Incorrect |
319 ms |
96000 KB |
Output isn't correct |
52 |
Incorrect |
325 ms |
96116 KB |
Output isn't correct |
53 |
Incorrect |
312 ms |
95276 KB |
Output isn't correct |
54 |
Incorrect |
257 ms |
77180 KB |
Output isn't correct |
55 |
Incorrect |
253 ms |
72440 KB |
Output isn't correct |
56 |
Correct |
370 ms |
95980 KB |
Output is correct |
57 |
Incorrect |
240 ms |
65400 KB |
Output isn't correct |
58 |
Incorrect |
246 ms |
70392 KB |
Output isn't correct |
59 |
Incorrect |
242 ms |
67448 KB |
Output isn't correct |
60 |
Correct |
312 ms |
87956 KB |
Output is correct |
61 |
Correct |
380 ms |
96116 KB |
Output is correct |
62 |
Correct |
375 ms |
95992 KB |
Output is correct |
63 |
Correct |
371 ms |
95984 KB |
Output is correct |
64 |
Correct |
254 ms |
78852 KB |
Output is correct |
65 |
Incorrect |
307 ms |
94952 KB |
Output isn't correct |
66 |
Incorrect |
311 ms |
82040 KB |
Output isn't correct |
67 |
Incorrect |
323 ms |
96120 KB |
Output isn't correct |
68 |
Incorrect |
335 ms |
95964 KB |
Output isn't correct |
69 |
Incorrect |
239 ms |
64916 KB |
Output isn't correct |
70 |
Incorrect |
125 ms |
37880 KB |
Output isn't correct |
71 |
Incorrect |
237 ms |
57872 KB |
Output isn't correct |
72 |
Incorrect |
246 ms |
63608 KB |
Output isn't correct |
73 |
Incorrect |
242 ms |
64412 KB |
Output isn't correct |
74 |
Incorrect |
242 ms |
65552 KB |
Output isn't correct |
75 |
Incorrect |
244 ms |
67192 KB |
Output isn't correct |
76 |
Incorrect |
248 ms |
68644 KB |
Output isn't correct |
77 |
Incorrect |
251 ms |
69112 KB |
Output isn't correct |
78 |
Incorrect |
257 ms |
69296 KB |
Output isn't correct |
79 |
Incorrect |
175 ms |
41596 KB |
Output isn't correct |
80 |
Incorrect |
181 ms |
43036 KB |
Output isn't correct |
81 |
Incorrect |
181 ms |
43456 KB |
Output isn't correct |
82 |
Incorrect |
258 ms |
71772 KB |
Output isn't correct |
83 |
Incorrect |
256 ms |
71940 KB |
Output isn't correct |
84 |
Incorrect |
171 ms |
36968 KB |
Output isn't correct |
85 |
Incorrect |
250 ms |
70724 KB |
Output isn't correct |
86 |
Incorrect |
354 ms |
94456 KB |
Output isn't correct |
87 |
Incorrect |
244 ms |
69640 KB |
Output isn't correct |
88 |
Incorrect |
255 ms |
70924 KB |
Output isn't correct |
89 |
Incorrect |
285 ms |
79944 KB |
Output isn't correct |
90 |
Incorrect |
156 ms |
52216 KB |
Output isn't correct |
91 |
Incorrect |
264 ms |
74436 KB |
Output isn't correct |
92 |
Incorrect |
287 ms |
80092 KB |
Output isn't correct |
93 |
Incorrect |
360 ms |
93408 KB |
Output isn't correct |
94 |
Incorrect |
288 ms |
79952 KB |
Output isn't correct |
95 |
Incorrect |
257 ms |
71928 KB |
Output isn't correct |
96 |
Incorrect |
272 ms |
71360 KB |
Output isn't correct |
97 |
Incorrect |
357 ms |
94360 KB |
Output isn't correct |
98 |
Incorrect |
256 ms |
71544 KB |
Output isn't correct |
99 |
Incorrect |
283 ms |
79340 KB |
Output isn't correct |
100 |
Incorrect |
355 ms |
92600 KB |
Output isn't correct |