#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
#define pb push_back
#define pf push_front
#define p push
#define q queue
#define popf pop_front()
#define popb pop_back()
#define dq deque
#define fi first
#define se second
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define pq priority_queue
#define st stack
#define rep(i,a,b) for (ll i=a; i<b; i++)
#define rept(i,a,b) for (ll i=a; i<=b; i++)
#define repr(i,a,b) for (ll i=a; i>=b; i--)
#define ppi pair<ll,ll>
#define test cout<<"A"<<endl
using namespace std;
ll a,b;
ve<string> mp;
ve<string> hor;
ve<string> ver;
int main(){
ios_base::sync_with_stdio(false);
// cin.tie(NULL);
cin>>a>>b;
rep(i,0,a){
string s;
cin>>s;
mp.pb(s);
hor.pb(s);
ver.pb(s);
}
rep(i,0,a){
rep(j,0,b){
if (mp[i][j] == '1'){
if (i != 0){
ver[i][j]+= ver[i-1][j]-'0';
ver[i-1][j] = '0';
}
if (j != 0){
hor[i][j]+= hor[i][j-1]-'0';
hor[i][j-1] = '0';
}
}
}
}
ll ans = 1e9;
rep(i,0,a){
rep(j,0,b){
ll temp = ver[i][j]-'0';
if (temp == 0) temp = 99999;
ans = min(ans, temp);
}
}
if (ans == 99999){
ans = 0;
}
ll k = 1e9;
rep(i,0,a){
rep(j,0,b){
ll temp = hor[i][j]-'0';
if (temp == 0) temp = 99999;
k = min(k, temp);
}
}
if (k==99999){
k = 0;
}
cout<<ans*k<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
724 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
724 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
19 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
20 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
21 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
22 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
23 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
24 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
25 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
26 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
27 |
Incorrect |
2 ms |
596 KB |
Output isn't correct |
28 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
29 |
Incorrect |
2 ms |
724 KB |
Output isn't correct |
30 |
Incorrect |
2 ms |
852 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
724 KB |
Output isn't correct |
32 |
Incorrect |
1 ms |
852 KB |
Output isn't correct |
33 |
Incorrect |
2 ms |
980 KB |
Output isn't correct |
34 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
35 |
Incorrect |
2 ms |
980 KB |
Output isn't correct |
36 |
Incorrect |
3 ms |
996 KB |
Output isn't correct |
37 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
38 |
Incorrect |
58 ms |
19072 KB |
Output isn't correct |
39 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
40 |
Incorrect |
10 ms |
2768 KB |
Output isn't correct |
41 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
42 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
43 |
Incorrect |
50 ms |
19088 KB |
Output isn't correct |
44 |
Incorrect |
2 ms |
980 KB |
Output isn't correct |
45 |
Incorrect |
48 ms |
18992 KB |
Output isn't correct |
46 |
Correct |
45 ms |
19088 KB |
Output is correct |
47 |
Incorrect |
49 ms |
19072 KB |
Output isn't correct |
48 |
Incorrect |
46 ms |
19028 KB |
Output isn't correct |
49 |
Incorrect |
53 ms |
19028 KB |
Output isn't correct |
50 |
Incorrect |
45 ms |
19000 KB |
Output isn't correct |
51 |
Incorrect |
45 ms |
18976 KB |
Output isn't correct |
52 |
Incorrect |
46 ms |
19064 KB |
Output isn't correct |
53 |
Incorrect |
46 ms |
18992 KB |
Output isn't correct |
54 |
Incorrect |
40 ms |
19044 KB |
Output isn't correct |
55 |
Incorrect |
41 ms |
19028 KB |
Output isn't correct |
56 |
Incorrect |
64 ms |
19072 KB |
Output isn't correct |
57 |
Incorrect |
38 ms |
19068 KB |
Output isn't correct |
58 |
Incorrect |
43 ms |
19008 KB |
Output isn't correct |
59 |
Incorrect |
40 ms |
19028 KB |
Output isn't correct |
60 |
Incorrect |
43 ms |
19080 KB |
Output isn't correct |
61 |
Incorrect |
54 ms |
19076 KB |
Output isn't correct |
62 |
Incorrect |
59 ms |
19080 KB |
Output isn't correct |
63 |
Incorrect |
55 ms |
19064 KB |
Output isn't correct |
64 |
Incorrect |
39 ms |
19028 KB |
Output isn't correct |
65 |
Incorrect |
44 ms |
19080 KB |
Output isn't correct |
66 |
Incorrect |
45 ms |
19064 KB |
Output isn't correct |
67 |
Incorrect |
48 ms |
19028 KB |
Output isn't correct |
68 |
Incorrect |
50 ms |
19080 KB |
Output isn't correct |
69 |
Incorrect |
39 ms |
18976 KB |
Output isn't correct |
70 |
Incorrect |
22 ms |
12372 KB |
Output isn't correct |
71 |
Incorrect |
36 ms |
18980 KB |
Output isn't correct |
72 |
Incorrect |
37 ms |
19064 KB |
Output isn't correct |
73 |
Incorrect |
39 ms |
19064 KB |
Output isn't correct |
74 |
Incorrect |
40 ms |
18984 KB |
Output isn't correct |
75 |
Incorrect |
39 ms |
19032 KB |
Output isn't correct |
76 |
Incorrect |
39 ms |
19028 KB |
Output isn't correct |
77 |
Incorrect |
40 ms |
19044 KB |
Output isn't correct |
78 |
Incorrect |
41 ms |
19076 KB |
Output isn't correct |
79 |
Incorrect |
32 ms |
19076 KB |
Output isn't correct |
80 |
Incorrect |
33 ms |
19088 KB |
Output isn't correct |
81 |
Incorrect |
35 ms |
19072 KB |
Output isn't correct |
82 |
Incorrect |
43 ms |
18972 KB |
Output isn't correct |
83 |
Incorrect |
41 ms |
19068 KB |
Output isn't correct |
84 |
Incorrect |
32 ms |
19028 KB |
Output isn't correct |
85 |
Incorrect |
39 ms |
19020 KB |
Output isn't correct |
86 |
Incorrect |
56 ms |
18968 KB |
Output isn't correct |
87 |
Incorrect |
42 ms |
19064 KB |
Output isn't correct |
88 |
Incorrect |
41 ms |
19068 KB |
Output isn't correct |
89 |
Incorrect |
45 ms |
18972 KB |
Output isn't correct |
90 |
Incorrect |
24 ms |
12376 KB |
Output isn't correct |
91 |
Incorrect |
44 ms |
19072 KB |
Output isn't correct |
92 |
Incorrect |
46 ms |
19028 KB |
Output isn't correct |
93 |
Incorrect |
55 ms |
19064 KB |
Output isn't correct |
94 |
Incorrect |
43 ms |
19028 KB |
Output isn't correct |
95 |
Incorrect |
41 ms |
19020 KB |
Output isn't correct |
96 |
Incorrect |
41 ms |
19068 KB |
Output isn't correct |
97 |
Incorrect |
56 ms |
19064 KB |
Output isn't correct |
98 |
Incorrect |
46 ms |
19028 KB |
Output isn't correct |
99 |
Incorrect |
50 ms |
19028 KB |
Output isn't correct |
100 |
Incorrect |
56 ms |
19076 KB |
Output isn't correct |