Submission #833209

#TimeUsernameProblemLanguageResultExecution timeMemory
833209vjudge1Bomb (IZhO17_bomb)C++17
6 / 100
264 ms19724 KiB
#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; int m, n, ans; string s[2500]; vector<int> v; void sub1a(){ int k=0; for(int i=0; i<=m; i++){ if(i<m && s[1][i]=='1') k++; else{ if(k>0) v.pb(k); k=0; } } sort(v.begin(), v.end()); if(v.size()>0) ans=v[0]; } void sub1b(){ ans=1e5; int k=0; for(int i=1; i<=n+1; i++){ if(i<=n && s[i][0]=='1') k++; else{ if(k>0) v.pb(k); k=0; } } sort(v.begin(), v.end()); if(v.size()>0) ans=v[0]; } int main(){ cin >> n >> m; for(int i=1; i<=n; i++){ cin >> s[i]; } if(n==1) sub1a(); else if(m==1) sub1b(); cout << ans << endl; return 0; }

Compilation message (stderr)

bomb.cpp: In function 'void sub1a()':
bomb.cpp:17:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   17 |    if(k>0) v.pb(k); k=0;
      |    ^~
bomb.cpp:17:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   17 |    if(k>0) v.pb(k); k=0;
      |                     ^
bomb.cpp: In function 'void sub1b()':
bomb.cpp:30:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   30 |    if(k>0) v.pb(k); k=0;
      |    ^~
bomb.cpp:30:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   30 |    if(k>0) v.pb(k); k=0;
      |                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...