Submission #833271

#TimeUsernameProblemLanguageResultExecution timeMemory
833271vjudge1Bomb (IZhO17_bomb)C++17
3 / 100
46 ms7124 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,1,n){
        cin>>v[i];
    }
    mi=inf;
   fr(i,1,n){
        a = 0;
        fr(j,1,m){
            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,1,m){
        a = 0;
        fr(i,1,n){
            if(v[i][j] == '1'){
                a++;
            }
            else{
                if(a){
                    ma = min(ma, a); a = 0;
                }
            }
        }
   } 
   if(a) ma = min(ma, a); a = 0;
   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;
}

Compilation message (stderr)

bomb.cpp: In function 'void solve()':
bomb.cpp:57:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   57 |    if(a) ma = min(ma, a); a = 0;
      |    ^~
bomb.cpp:57:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   57 |    if(a) ma = min(ma, a); a = 0;
      |                           ^
#Verdict Execution timeMemoryGrader output
Fetching results...