# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
171920 | mosiashvililuka | Bomb (IZhO17_bomb) | C++14 | 561 ms | 61840 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>
using namespace std;
int a,b,c,d,e,lf,rg,pas1,pas2,zx,xc,zm[2509][2509],qv[2509][2509];
char ch;
bool f[2509][2509];
int main(){
scanf("%d %d\n",&a,&b);
pas1=a+b+2;pas2=a+b+2;
for(c=1; c<=a; c++){
for(d=1; d<=b; d++){
scanf("%c",&ch);
if(ch=='1') f[c][d]=1;
}
scanf("\n");
}
for(d=1; d<=b; d++){
for(c=1; c<=a; c++){
if(f[c][d]==1){
zm[c][d]=zm[c-1][d]+1;
}
}
for(c=a; c>=1; c--){
if(f[c][d]==1){
qv[c][d]=qv[c+1][d]+1;
}
}
}
for(c=1; c<=a; c++){
lf=a+b+2;rg=a+b+2;
zx=0;
for(d=1; d<=b; d++){
if(f[c][d]==1){
zx++;
if(lf>zm[c][d]) lf=zm[c][d];
if(rg>qv[c][d]) rg=qv[c][d];
}else{
if(zx!=0){
if(pas1>zx) pas1=zx;
if(pas2>lf+rg-1) pas2=lf+rg-1;
}
zx=0;lf=a+b+2;rg=a+b+2;
}
}
if(zx!=0){
if(pas1>zx) pas1=zx;
if(pas2>lf+rg+1) pas2=lf+rg-1;
}
}
cout<<pas1*pas2;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |