//#ifndef LOCAL
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#endif
#include <bits/stdc++.h>
using namespace std;
using vecp = vector<pair<int,int>>;
#define vecm(a,n,m) vector<vector<int>>a(n,vector<int>(m,0));
#define int int64_t
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mpii map<int,int>
#define lb lower_bound
#define ub upper_bound
#define foor(i,a,b) for(int i=a;i<b; i++)
#define foor(i,a) foor(i,0,a)
#define ins insert
#define ss second
#define ff first
#define until(x, a) for (auto x : a)
#define ln(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define seea(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define seev(v,n) for(int i=0;i<n;i++){int x; cin>>x; v.push_back(x);}
const int mod = 1E9+7;
void solution(){
int n,m;
cin >> n >> m;
vector<vector<char>> vec(n,vector<char>(m));
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
cin >> vec[i][j];
}
}
int a=0,b=0,cnt=0,mn=INT_MAX;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(vec[i][j]=='1')cnt++;
else {
if(cnt>0)mn=min(mn,cnt);
cnt=0;
}
}
if(cnt>0){
mn=min(mn,cnt);
cnt=0;
}
}
a=mn;
mn=INT_MAX;
cnt=0;
for(int i=0; i<m; i++){
for(int j=0; j<n; j++){
if(vec[j][i]=='1')cnt++;
else {
if(cnt>0)mn=min(mn,cnt);
cnt=0;
}
}
if(cnt>0){
mn=min(mn,cnt);
cnt=0;
}
}
b=mn;
if(a==INT_MAX){
cout << 0;
}
else {
cout << a*b;
}
}
int32_t main(){
clock_t tStart = clock();
std::ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int q = 1; // cin >> q;
while(q--) {
solution();
cout << '\n';
}
}
/*
██╗ ██╗ █████╗ ██████╗ ██╗██╗ ██╗ ██████╗████████╗
██║░░██║██╔══██╗██╔════╝░░░░░██║██║░░░██║██╔════╝╚══██╔══╝
███████║██║░░██║╚█████╗░░░░░░██║██║░░░██║╚█████╗░░░░██║░░░
██╔══██║██║░░██║░╚═══██╗██╗░░██║██║░░░██║░╚═══██╗░░░██║░░░
██║░░██║╚█████╔╝██████╔╝╚█████╔╝╚██████╔╝██████╔╝░░░██║░░░
╚═╝░░╚═╝░╚════╝░╚═════╝░░╚════╝░░╚═════╝░╚═════╝░░░░╚═╝░░░
*/
Compilation message
road.cpp:19: warning: "foor" redefined
19 | #define foor(i,a) foor(i,0,a)
|
road.cpp:18: note: this is the location of the previous definition
18 | #define foor(i,a,b) for(int i=a;i<b; i++)
|
road.cpp: In function 'int32_t main()':
road.cpp:77:13: warning: unused variable 'tStart' [-Wunused-variable]
77 | clock_t tStart = clock();
| ^~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |