Submission #1128793

#TimeUsernameProblemLanguageResultExecution timeMemory
1128793batyiBomb (IZhO17_bomb)C++20
24 / 100
84 ms6600 KiB
/*
|01|11|2010|
*/
#include <bits/stdc++.h>
#define ll long long
#define int ll
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define sp setprecision
#define stl(v) v.begin(),v.end()
#define stlr(v) v.rbegin(),v.rend()
#define b1cnt __builtin_popcount

using namespace std;

const int N=2512;
const int mod=1e9+7;
const int inf=1e18;
const int M=55;

int n,m;
char a[N][N];

void prob(){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++) cin>>a[i][j];
	}
	int mnx=inf,mny=inf,cnt=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(a[i][j]=='1') cnt++;
			else{
				if(cnt) mnx=min(mnx,cnt);
				cnt=0;
			}
		}
		if(cnt) mnx=min(mnx,cnt);
		cnt=0;
	}
	for(int j=1;j<=m;j++){
		for(int i=1;i<=n;i++){
			if(a[i][j]=='1') cnt++;
			else{
				if(cnt) mny=min(mny,cnt);
				cnt=0;
			}
		}
		if(cnt) mny=min(mny,cnt);
		cnt=0;
	}
	if(mnx==inf) mnx=1;
	if(mny==inf) mny=1;
	cout<<mnx*mny;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t2=1;
//    cin>>t2; 
    for(int test=1;test<=t2;test++){
        prob();
    }
}

//       ▄▌▐▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█|
//    ▄▄██▌█════Фура═с═Кодами════█|
// ▄▄▄▌▐██▌█═Приехала═Разгружаем═█|
// ███████▌█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█|
// ▀(@)▀▀▀▀▀▀▀(@)(@)▀▀▀▀▀▀▀▀▀▀▀(@)
#Verdict Execution timeMemoryGrader output
Fetching results...