# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
344714 | infertechno2 | Bomb (IZhO17_bomb) | C++14 | 1 ms | 512 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>
using namespace std;
typedef long long ll;
string battleground;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n,m,smallest_territory=2501;
cin>>n>>m;
if(m==1)swap(n,m);
ll curr_terr_size=0;
cin>>battleground;
for(ll i=0;i<(ll)battleground.size();i++){
if(battleground[i]-'0'==1){
curr_terr_size++;
}else{
if(curr_terr_size!=0)smallest_territory=min(smallest_territory,curr_terr_size);
curr_terr_size=0;
}
}
if(curr_terr_size!=0)smallest_territory=min(smallest_territory,curr_terr_size);
if(smallest_territory==2501)smallest_territory=0;
cout<<smallest_territory<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |