# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833269 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 137 ms | 10568 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 ll long long
#define fi first
#define se second
#define pb push_back
#define pll pair<ll, ll>
using namespace std;
ll n, m, hor, ver;
string s[3000];
int main(){
cin >> n >> m;
for(int i=0; i<n; i++){
cin >> s[i];
}
//cari minimum di horizontal
vector<int> tmp;
for(int i=0; i<n; i++){
int cnt=0;
for(int j=0; j<=m; j++){
if(j==m || s[i][j]=='0'){
if(cnt>0) tmp.pb(cnt); cnt=0;
}
else cnt++;
}
}
sort(tmp.begin(), tmp.end());
if(tmp.size()>0) hor=tmp[0];
tmp.clear();
//cari minimum di vertikal
for(int i=0; i<m; i++){
int cnt=0;
for(int j=0; j<=n; j++){
if(j==n || s[j][i]=='0'){
if(cnt>0) tmp.pb(cnt); cnt=0;
}
else cnt++;
}
}
sort(tmp.begin(), tmp.end());
if(tmp.size()>0) ver=tmp[0];
cout << hor*ver << endl;
return 0;
}
/*
10001
11111
11111
11111
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |