제출 #833293

#제출 시각아이디문제언어결과실행 시간메모리
833293vjudge1Bomb (IZhO17_bomb)C++17
24 / 100
38 ms7120 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define endl '\n';
#define el cout<<endl
#define fr(i,n,m) for(int i=n;i<=m;i++)
#define frr(i,n,m) for(int i=n;i>=m;i--)
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define inf 1e18

int n,m,k,l,r,num=0,ans=0,sum=0,mi=inf,ma=0;
int a,b,c,d,e,x,y,z,w,q;

const int N = 2500 + 5;
// vpi adj[N];
string v[N];
void solve(){
    cin >> n >> m;
    fr(i,0,n-1){
        cin >> v[i];
    }
    mi = inf;
    fr(i,0,n-1){
        a = 0;
        fr(j,0, m-1){
            if(v[i][j] == '1'){
                a++;
            }
            else{
                if(a){
                    mi = min(mi, a); a = 0;
                }
            }
        }
        if(a) mi = min(mi, a); 
    }
    
    ma = inf;
    fr(j, 0, m-1){
        a = 0;
        fr(i, 0, n-1){
            if(v[i][j] == '1'){
                a++;
            }
            else{
                if(a){
                    ma = min(ma, a); a = 0;
                }
            }
        }
        if(a) ma = min(ma, a); 
   } 
   cout << mi * ma;

}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int T = 1;
    // cin >> T;
    while(T--){
        cout<<fixed<<setprecision(12);solve();
        el;
    }return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...