SHARE
TWEET

secvzero_pbinfo

a guest Jan 21st, 2020 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.   int n, nr, l, st, stmax, lmax;
  7.   cin >> n;
  8.   l = lmax = 0;
  9.   for (int i = 1; i <= n; i ++) {
  10.     cin >> nr;
  11.     if (nr == 0)
  12.       l ++;
  13.     else
  14.       l = 0;
  15.     if (l == 1)
  16.       st = i;
  17.     if (l > lmax) {
  18.       lmax = l;
  19.       stmax = st;
  20.     }
  21.   }
  22.   cout << stmax << " " << stmax + lmax - 1;
  23.   return 0;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top