# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833176 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 40 ms | 7100 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
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m, lebar, tinggi, satu;
bool flag=true;
ll ans;
string s[2505];
cin>>n>>m;
for(int i=0; i<n; i++){
cin>>s[i];
}
lebar=m;
tinggi=n;
satu=0;
int j;
for(int i=0; i<n; i++){
j=0;
satu=0;
while(j<m){
if(s[i][j] == '1'){
satu++;
flag=false;
}
else{
if(satu>0) lebar=min(lebar, satu);
satu=0;
}
j++;
}
if(satu>0) lebar=min(lebar, satu);
}
for(int i=0; i<m; i++){
j=0;
satu=0;
while(j<n){
if(s[j][i] == '1') satu++;
else{
if(satu>0) tinggi=min(tinggi, satu);
satu=0;
}
j++;
}
if(satu>0) tinggi=min(tinggi, satu);
}
ans=(ll)tinggi*lebar;
if(flag) ans=0;
cout<<ans<<"\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |