Submission #386372

#TimeUsernameProblemLanguageResultExecution timeMemory
386372vanicBomb (IZhO17_bomb)C++14
1 / 100
1100 ms2028 KiB
#include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <set> #include <stack> #include <vector> #include <queue> #include <map> #include <cstring> #include <array> #include <bitset> using namespace std; const int maxn=2505; 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]; } } for(int i=0; i<n; i++){ for(int j=0; j<m; j++){ if(b[i][j]){ for(int k=i; k<i+x; k++){ for(int l=j; l<j+y; l++){ if(k>=n || l>=m || !b[k][l]){ return 0; } b[k][l]=0; } } } } } return 1; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> m; 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 timeMemoryGrader output
Fetching results...