# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
920196 | MilosMilutinovic | Bomb (IZhO17_bomb) | C++14 | 1053 ms | 2904 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.
// Online C++ compiler to run C++ program online
#include<bits/stdc++.h>
using namespace std;
int n,m;
char s[25][25];
bool was[25][25];
bool check(int x,int y){
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
was[i][j]=false;
}
}
for(int i=0;i+x<=n;i++){
for(int j=0;j+y<=m;j++){
bool ok=true;
for(int a=i;a<i+x;a++){
for(int b=j;b<j+y;b++){
if(s[a][b]=='0') ok=false;
}
}
if(ok){
for(int a=i;a<i+x;a++){
for(int b=j;b<j+y;b++){
was[a][b]=true;
}
}
}
}
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(s[i][j]=='1'&&!was[i][j]){
return false;
}
}
}
return true;
}
int main(){
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++) scanf("%s",s[i]);
int ans=0;
for(int x=1;x<=n;x++){
for(int y=1;y<=m;y++){
if(check(x,y)) ans=max(ans,x*y);
}
}
printf("%d\n",ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |