#include <bits/stdc++.h>
using namespace std;
#define clr(i, j) memset(i, j, sizeof(i))
#define pb push_back
typedef long long ll;
//-*-*-*-*-*-*-*-*-
set<ll>s;
ll n,m;
ll ar[10000][2500];
bool valid(ll x ,ll y){
if(x<n&&y<m&&x>=0&&y>=0&&ar[x][y]==1){return 1;}
return 0;
}
int main()
{
cin>>n>>m;
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
char c;
cin >> c;
ar[i][j] = c - '0';
}
}
ll a=99999999;ll b=99999999;
for(int i=0;i<n;i++){
for(ll l=0;l<m;l++){
ll k=1; ll f=1;
if(valid(i,l)){
ll t=l+1;
while(valid(i,t)){t++;k++;}
t=l-1;
while(valid(i,t)){t--;k++;}
ll d=i-1;
while(valid(d,l)){d--;f++;}
d=i+1;
while(valid(d,l)){d++;f++;}
a=min(k,a);b=min(f,b);
//if(f==1){cout<<i<<l;return 0;}
}
}
}
cout<<a*b;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
15 ms |
10496 KB |
Output is correct |
4 |
Correct |
11 ms |
10496 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
13 |
Correct |
3 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
3 ms |
640 KB |
Output is correct |
18 |
Incorrect |
3 ms |
640 KB |
Output isn't correct |
19 |
Incorrect |
3 ms |
768 KB |
Output isn't correct |
20 |
Incorrect |
2 ms |
768 KB |
Output isn't correct |
21 |
Incorrect |
3 ms |
512 KB |
Output isn't correct |
22 |
Incorrect |
3 ms |
640 KB |
Output isn't correct |
23 |
Incorrect |
3 ms |
768 KB |
Output isn't correct |
24 |
Incorrect |
3 ms |
768 KB |
Output isn't correct |
25 |
Incorrect |
3 ms |
768 KB |
Output isn't correct |
26 |
Correct |
5 ms |
768 KB |
Output is correct |
27 |
Correct |
44 ms |
2156 KB |
Output is correct |
28 |
Incorrect |
11 ms |
2328 KB |
Output isn't correct |
29 |
Incorrect |
68 ms |
2908 KB |
Output isn't correct |
30 |
Incorrect |
26 ms |
3576 KB |
Output isn't correct |
31 |
Incorrect |
19 ms |
2816 KB |
Output isn't correct |
32 |
Incorrect |
18 ms |
3200 KB |
Output isn't correct |
33 |
Incorrect |
45 ms |
3812 KB |
Output isn't correct |
34 |
Incorrect |
9 ms |
2456 KB |
Output isn't correct |
35 |
Incorrect |
18 ms |
3712 KB |
Output isn't correct |
36 |
Correct |
197 ms |
3832 KB |
Output is correct |
37 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
38 |
Execution timed out |
1064 ms |
55008 KB |
Time limit exceeded |
39 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
40 |
Execution timed out |
1072 ms |
10360 KB |
Time limit exceeded |
41 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
42 |
Incorrect |
4 ms |
768 KB |
Output isn't correct |
43 |
Execution timed out |
1065 ms |
55000 KB |
Time limit exceeded |
44 |
Incorrect |
85 ms |
3832 KB |
Output isn't correct |
45 |
Execution timed out |
1073 ms |
55036 KB |
Time limit exceeded |
46 |
Correct |
495 ms |
55032 KB |
Output is correct |
47 |
Execution timed out |
1082 ms |
54904 KB |
Time limit exceeded |
48 |
Execution timed out |
1074 ms |
55032 KB |
Time limit exceeded |
49 |
Execution timed out |
1070 ms |
55032 KB |
Time limit exceeded |
50 |
Execution timed out |
1074 ms |
55032 KB |
Time limit exceeded |
51 |
Execution timed out |
1080 ms |
55072 KB |
Time limit exceeded |
52 |
Execution timed out |
1056 ms |
55144 KB |
Time limit exceeded |
53 |
Execution timed out |
1070 ms |
54940 KB |
Time limit exceeded |
54 |
Execution timed out |
1071 ms |
55032 KB |
Time limit exceeded |
55 |
Execution timed out |
1074 ms |
55156 KB |
Time limit exceeded |
56 |
Execution timed out |
1075 ms |
55032 KB |
Time limit exceeded |
57 |
Execution timed out |
1083 ms |
55032 KB |
Time limit exceeded |
58 |
Execution timed out |
1082 ms |
54908 KB |
Time limit exceeded |
59 |
Execution timed out |
1076 ms |
55036 KB |
Time limit exceeded |
60 |
Execution timed out |
1075 ms |
54904 KB |
Time limit exceeded |
61 |
Execution timed out |
1082 ms |
55164 KB |
Time limit exceeded |
62 |
Execution timed out |
1083 ms |
55220 KB |
Time limit exceeded |
63 |
Execution timed out |
1083 ms |
55016 KB |
Time limit exceeded |
64 |
Execution timed out |
1086 ms |
55032 KB |
Time limit exceeded |
65 |
Execution timed out |
1077 ms |
55032 KB |
Time limit exceeded |
66 |
Execution timed out |
1074 ms |
55196 KB |
Time limit exceeded |
67 |
Execution timed out |
1074 ms |
55284 KB |
Time limit exceeded |
68 |
Execution timed out |
1077 ms |
55160 KB |
Time limit exceeded |
69 |
Execution timed out |
1060 ms |
55200 KB |
Time limit exceeded |
70 |
Incorrect |
739 ms |
43128 KB |
Output isn't correct |
71 |
Execution timed out |
1077 ms |
55164 KB |
Time limit exceeded |
72 |
Execution timed out |
1079 ms |
55136 KB |
Time limit exceeded |
73 |
Execution timed out |
1078 ms |
55160 KB |
Time limit exceeded |
74 |
Execution timed out |
1084 ms |
55288 KB |
Time limit exceeded |
75 |
Execution timed out |
1083 ms |
55268 KB |
Time limit exceeded |
76 |
Execution timed out |
1081 ms |
55288 KB |
Time limit exceeded |
77 |
Execution timed out |
1079 ms |
55160 KB |
Time limit exceeded |
78 |
Execution timed out |
1077 ms |
55288 KB |
Time limit exceeded |
79 |
Incorrect |
397 ms |
55132 KB |
Output isn't correct |
80 |
Incorrect |
408 ms |
55288 KB |
Output isn't correct |
81 |
Incorrect |
492 ms |
55416 KB |
Output isn't correct |
82 |
Execution timed out |
1080 ms |
55460 KB |
Time limit exceeded |
83 |
Execution timed out |
1057 ms |
55416 KB |
Time limit exceeded |
84 |
Incorrect |
446 ms |
55288 KB |
Output isn't correct |
85 |
Execution timed out |
1075 ms |
55408 KB |
Time limit exceeded |
86 |
Execution timed out |
1080 ms |
55416 KB |
Time limit exceeded |
87 |
Execution timed out |
1070 ms |
55444 KB |
Time limit exceeded |
88 |
Execution timed out |
1085 ms |
55416 KB |
Time limit exceeded |
89 |
Execution timed out |
1084 ms |
55452 KB |
Time limit exceeded |
90 |
Execution timed out |
1046 ms |
43372 KB |
Time limit exceeded |
91 |
Execution timed out |
1074 ms |
55288 KB |
Time limit exceeded |
92 |
Execution timed out |
1072 ms |
55280 KB |
Time limit exceeded |
93 |
Execution timed out |
1072 ms |
55260 KB |
Time limit exceeded |
94 |
Execution timed out |
1087 ms |
55288 KB |
Time limit exceeded |
95 |
Execution timed out |
1085 ms |
55288 KB |
Time limit exceeded |
96 |
Execution timed out |
1081 ms |
55416 KB |
Time limit exceeded |
97 |
Execution timed out |
1081 ms |
55388 KB |
Time limit exceeded |
98 |
Execution timed out |
1083 ms |
55288 KB |
Time limit exceeded |
99 |
Execution timed out |
1075 ms |
55348 KB |
Time limit exceeded |
100 |
Execution timed out |
1070 ms |
55468 KB |
Time limit exceeded |