Advertisement
Guest User

secvzero_pbinfo

a guest
Jan 21st, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement