#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);
}
}
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 (ans == k){
k--;
}
cout<<ans*k<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
216 KB |
Output is correct |
3 |
Incorrect |
1 ms |
708 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
724 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
9 |
Incorrect |
1 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 |
Correct |
1 ms |
320 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Incorrect |
0 ms |
328 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
316 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 |
1 ms |
340 KB |
Output isn't correct |
19 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
20 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
21 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
22 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
23 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
24 |
Incorrect |
0 ms |
328 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 |
1 ms |
684 KB |
Output isn't correct |
28 |
Incorrect |
1 ms |
720 KB |
Output isn't correct |
29 |
Incorrect |
2 ms |
844 KB |
Output isn't correct |
30 |
Incorrect |
2 ms |
1116 KB |
Output isn't correct |
31 |
Incorrect |
3 ms |
976 KB |
Output isn't correct |
32 |
Incorrect |
2 ms |
972 KB |
Output isn't correct |
33 |
Incorrect |
2 ms |
1104 KB |
Output isn't correct |
34 |
Incorrect |
2 ms |
596 KB |
Output isn't correct |
35 |
Incorrect |
2 ms |
1176 KB |
Output isn't correct |
36 |
Incorrect |
4 ms |
1104 KB |
Output isn't correct |
37 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
38 |
Incorrect |
65 ms |
22252 KB |
Output isn't correct |
39 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
40 |
Incorrect |
9 ms |
3388 KB |
Output isn't correct |
41 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
42 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
43 |
Incorrect |
57 ms |
22756 KB |
Output isn't correct |
44 |
Incorrect |
2 ms |
1100 KB |
Output isn't correct |
45 |
Incorrect |
58 ms |
22652 KB |
Output isn't correct |
46 |
Incorrect |
49 ms |
22608 KB |
Output isn't correct |
47 |
Incorrect |
50 ms |
22616 KB |
Output isn't correct |
48 |
Incorrect |
50 ms |
22776 KB |
Output isn't correct |
49 |
Incorrect |
58 ms |
22668 KB |
Output isn't correct |
50 |
Incorrect |
50 ms |
22648 KB |
Output isn't correct |
51 |
Incorrect |
51 ms |
22892 KB |
Output isn't correct |
52 |
Incorrect |
57 ms |
23128 KB |
Output isn't correct |
53 |
Incorrect |
52 ms |
22872 KB |
Output isn't correct |
54 |
Incorrect |
43 ms |
22928 KB |
Output isn't correct |
55 |
Incorrect |
42 ms |
22908 KB |
Output isn't correct |
56 |
Incorrect |
58 ms |
22908 KB |
Output isn't correct |
57 |
Incorrect |
41 ms |
22908 KB |
Output isn't correct |
58 |
Incorrect |
42 ms |
22908 KB |
Output isn't correct |
59 |
Incorrect |
42 ms |
22840 KB |
Output isn't correct |
60 |
Incorrect |
47 ms |
22884 KB |
Output isn't correct |
61 |
Incorrect |
57 ms |
22928 KB |
Output isn't correct |
62 |
Incorrect |
59 ms |
22816 KB |
Output isn't correct |
63 |
Incorrect |
59 ms |
22836 KB |
Output isn't correct |
64 |
Incorrect |
44 ms |
22920 KB |
Output isn't correct |
65 |
Incorrect |
53 ms |
23060 KB |
Output isn't correct |
66 |
Incorrect |
53 ms |
23164 KB |
Output isn't correct |
67 |
Incorrect |
51 ms |
23124 KB |
Output isn't correct |
68 |
Incorrect |
50 ms |
23072 KB |
Output isn't correct |
69 |
Incorrect |
43 ms |
23088 KB |
Output isn't correct |
70 |
Incorrect |
23 ms |
15516 KB |
Output isn't correct |
71 |
Incorrect |
38 ms |
23416 KB |
Output isn't correct |
72 |
Incorrect |
41 ms |
23396 KB |
Output isn't correct |
73 |
Incorrect |
45 ms |
23308 KB |
Output isn't correct |
74 |
Incorrect |
40 ms |
23528 KB |
Output isn't correct |
75 |
Incorrect |
40 ms |
23372 KB |
Output isn't correct |
76 |
Incorrect |
45 ms |
23668 KB |
Output isn't correct |
77 |
Incorrect |
42 ms |
23756 KB |
Output isn't correct |
78 |
Incorrect |
42 ms |
23828 KB |
Output isn't correct |
79 |
Incorrect |
35 ms |
23880 KB |
Output isn't correct |
80 |
Incorrect |
33 ms |
23840 KB |
Output isn't correct |
81 |
Incorrect |
41 ms |
24064 KB |
Output isn't correct |
82 |
Incorrect |
45 ms |
24032 KB |
Output isn't correct |
83 |
Incorrect |
43 ms |
23940 KB |
Output isn't correct |
84 |
Incorrect |
33 ms |
24000 KB |
Output isn't correct |
85 |
Incorrect |
41 ms |
23936 KB |
Output isn't correct |
86 |
Incorrect |
56 ms |
23944 KB |
Output isn't correct |
87 |
Incorrect |
42 ms |
23972 KB |
Output isn't correct |
88 |
Incorrect |
41 ms |
24040 KB |
Output isn't correct |
89 |
Incorrect |
45 ms |
24060 KB |
Output isn't correct |
90 |
Incorrect |
26 ms |
16284 KB |
Output isn't correct |
91 |
Incorrect |
43 ms |
24084 KB |
Output isn't correct |
92 |
Incorrect |
47 ms |
23988 KB |
Output isn't correct |
93 |
Incorrect |
58 ms |
24000 KB |
Output isn't correct |
94 |
Incorrect |
47 ms |
23968 KB |
Output isn't correct |
95 |
Incorrect |
43 ms |
23984 KB |
Output isn't correct |
96 |
Incorrect |
47 ms |
24048 KB |
Output isn't correct |
97 |
Incorrect |
58 ms |
23944 KB |
Output isn't correct |
98 |
Incorrect |
43 ms |
23920 KB |
Output isn't correct |
99 |
Incorrect |
46 ms |
23940 KB |
Output isn't correct |
100 |
Incorrect |
54 ms |
23704 KB |
Output isn't correct |