# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833406 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 177 ms | 10308 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, cnt;
string s[3000];
int main(){
cin >> n >> m;
for(ll i=0; i<n; i++){
cin >> s[i];
}
hor=n; ver=m;
//cari minimum di horizontal
for(ll i=0; i<n; i++){
cnt=0;
bool ujung=1;
for(ll j=0; j<m; j++){
if(s[i][j]=='0'){
if(cnt>0 && !ujung) hor=min(hor, cnt); cnt=0;
ujung=0;
}
else cnt++;
}
}
//cari minimum di vertikal
for(ll i=0; i<m; i++){
cnt=0;
bool ujung=1;
for(ll j=0; j<n; j++){
if(s[j][i]=='0'){
if(cnt>0 && !ujung) ver=min(ver, cnt); cnt=0;
ujung=0;
}
else cnt++;
}
}
cout << hor*ver << endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |