Submission #171075

#TimeUsernameProblemLanguageResultExecution timeMemory
171075mosiashvililukaBomb (IZhO17_bomb)C++14
6 / 100
42 ms25772 KiB
#include<bits/stdc++.h> using namespace std; int a,b,c,d,e,f[2509][2509]; string s; int main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>a>>b; for(c=1; c<=a; c++){ cin>>s; for(d=1; d<=b; d++){ f[c][d]=s[d-1]-'0'; } } if(a==1){ d=0; e=b; for(c=1; c<=b; c++){ if(f[1][c]==1){ d++; }else{ if(d!=0) e=min(d,e); d=0; } } if(d!=0) e=min(d,e); } if(b==1){ d=0; e=a; for(c=1; c<=a; c++){ if(f[c][1]==1){ d++; }else{ if(d!=0) e=min(d,e); d=0; } } if(d!=0) e=min(d,e); } cout<<e; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...