Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int start = 0, stop = 0;
- int lungimeMaxima = 0, lungimeSecventaInCurs = 1;
- int x, y;
- cin >> x;
- for (int i = 2; i <= n; ++i)
- {
- cin >> y;
- if (x == y)
- ++lungimeSecventaInCurs;
- else
- lungimeSecventaInCurs = 1;
- if (lungimeSecventaInCurs >= lungimeMaxima)
- {
- lungimeMaxima = lungimeSecventaInCurs;
- start = i - lungimeSecventaInCurs + 1;
- stop = i;
- }
- x = y;
- }
- cout << start << ' ' << stop;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement