# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833360 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 160 ms | 12236 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=1, ver=1, cnt;
string s[3000];
int main(){
cin >> n >> m;
for(ll i=0; i<n; i++){
cin >> s[i];
}
//cari minimum di horizontal
vector<ll> tmp1;
for(ll i=0; i<n; i++){
cnt=0;
for(ll j=0; j<=m; j++){
if(j==m || s[i][j]=='0'){
if(cnt>0) tmp1.pb(cnt); cnt=0;
}
else cnt++;
}
}
sort(tmp1.begin(), tmp1.end());
if(tmp1.size()>0) hor=tmp1[0];
//cari minimum di vertikal
vector<ll> tmp;
for(ll i=0; i<m; i++){
cnt=0;
for(ll 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;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |