# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
386386 | vanic | Bomb (IZhO17_bomb) | C++14 | 1093 ms | 640 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 <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <map>
#include <cstring>
#include <array>
#include <bitset>
#include <cassert>
using namespace std;
const int maxn=105;
bitset < maxn > a[maxn];
bitset < maxn > b[maxn];
int n, m;
bool provjeri(int x, int y){
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
b[i][j]=a[i][j];
}
}
bool ne;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(a[i][j]){
ne=0;
for(int k=i; k<i+x; k++){
for(int l=j; l<j+y; l++){
if(k>=n || l>=m || !a[k][l]){
ne=1;
continue;
}
}
}
if(!ne){
for(int k=i; k<i+x; k++){
for(int l=j; l<j+y; l++){
b[k][l]=0;
}
}
}
}
}
}
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(b[i][j]){
return 0;
}
}
}
return 1;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
assert(n<maxn && m<maxn);
string s;
for(int i=0; i<n; i++){
cin >> s;
for(int j=0; j<m; j++){
if(s[j]=='1'){
a[i][j]=1;
}
}
}
int maksi=0;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
if(provjeri(i, j)){
maksi=max(maksi, i*j);
}
}
}
cout << maksi << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |