Submission #1126946

#TimeUsernameProblemLanguageResultExecution timeMemory
1126946bekzhan29Bomb (IZhO17_bomb)C++20
24 / 100
83 ms30784 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define INF (long long)(2e15) #define mod2 998244353 #define mod 1000000007 #define eps 1e-9 #define abs(x) ((x)>=0?(x):-(x)) #define y1 solai #define fi first #define se second typedef int ll; typedef long double ld; typedef pair<ll,ll> pll; typedef pair<double,double> pdd; typedef pair<pll, ll> plll; mt19937 rng(29); const ll N=3100; ll n,m,a[N][N],h,w; string s; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>n>>m; h=n; w=m; for(ll i=1;i<=n;i++) { cin>>s; for(ll j=1;j<=m;j++) a[i][j]=s[j-1]-'0'; } for(ll i=1;i<=n;i++) for(ll j=1;j<=m;j++) { if(!a[i][j]) continue; if(a[i][j+1]==0) { ll len=0; for(ll k=j;k>=1&&a[i][k];k--) len++; w=min(w,len); } if(a[i+1][j]==0) { ll len=0; for(ll k=i;k>=1&&a[k][j];k--) len++; h=min(h,len); } } cout<<h*w; } /* */
#Verdict Execution timeMemoryGrader output
Fetching results...