# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
332772 | Bill_00 | Bomb (IZhO17_bomb) | C++14 | 423 ms | 6704 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 MOD 1000000007
typedef long long ll;
using namespace std;
char a[2501][2501];
int main(){
//ios_base::sync_with_stdio(NULL);
// cin.tie(NULL);
// cout.tie(NULL);
int n,m;
cin >> n >>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin >> a[i][j];
}
}
int l,r,width=m,length=n;
for(int i=1;i<=n;i++){
l=-1;
for(int j=1;j<=m;j++){
if(a[i][j]=='0'){
if(l!=-1){
width=min(width,r-l+1);
}
l=-1;
}
else{
if(l==-1){
l=j;
}
r=j;
}
}
}
for(int i=1;i<=m;i++){
l=-1;
for(int j=1;j<=n;j++){
if(a[j][i]=='0'){
if(l!=-1){
length=min(length,r-l+1);
}
l=-1;
}
else{
if(l==-1){
l=j;
}
r=j;
}
}
}
cout << width*length;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |