Submission #91427

#TimeUsernameProblemLanguageResultExecution timeMemory
91427AbelyanBomb (IZhO17_bomb)C++17
6 / 100
3 ms1064 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pr; #define fr first #define sc second #define FOR(i, a) for (int i = 0; i < (a); i++) #define F0R(i, a, b) for (int i = (a); i <= (b); i++) #define FORd(i,a) for (int i = (a)-1; i >= 0; i--) #define F0Rd(i,a,b) for (int i = (b); i >= (a); i--) #define trav(a, x) for (auto& a : x) const int N=2506; char c[N][N]; int main(){ ios_base::sync_with_stdio(false); #ifndef EVAL //freopen("input.txt","r",stdin); #endif int n,m; cin>>n>>m; assert(n<=20 && m<=20); for (int i=0;i<n;i++){ cin>>c[i]; } int mn=INT_MAX; for (int i=0;i<n;i++){ int tv=0; for (int j=0;j<m;j++){ if (c[i][j]=='1'){ tv++; } else if(tv!=0){ mn=min(mn,tv); tv=0; } } if (tv!=0)mn=min(mn,tv); } int ans1=mn; mn=INT_MAX; for (int j=0;j<m;j++){ int tv=0; for (int i=0;i<n;i++){ if (c[i][j]=='1'){ tv++; } else if(tv!=0){ mn=min(mn,tv); tv=0; } } if (tv!=0)mn=min(mn,tv); } cout<<mn*ans1<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...