# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
167410 | GioChkhaidze | Bomb (IZhO17_bomb) | C++14 | 494 ms | 16124 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define Tree int h,int l,int r
#define Left 2*h,l,(l+r)/2
#define Right 2*h+1,(l+r)/2+1,r
using namespace std;
const int N=2505;
int n,m,width=1e9,length=1e9,last;
string s[N],S;
char c[N][N];
main () {
scanf("%d%d",&n,&m);
getline(cin,S);
for (int i=0; i<n; i++)
getline(cin,s[i]);
for (int i=0; i<n; i++) {
last=m;
for (int j=m-1; j>=0; j--) {
if (s[i][j]=='0' && last-1!=j)
if (width>last-j-1) width=last-j-1;
if (s[i][j]=='0') last=j;
}
if (last)
if (last<width) width=last;
}
for (int j=0; j<m; j++) {
last=n;
for (int i=n-1; i>=0; i--) {
if (s[i][j]=='0' && last-1!=i)
if (length>last-i-1) length=last-i-1;
if (s[i][j]=='0') last=i;
}
if (last)
if (last<length) length=last;
}
if (width==1e9) width=0;
if (length==1e9) length=0;
cout<<width*length<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |