Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- cin.tie(0);
- ios_base::sync_with_stdio(0);
- int N, X, x, a = 0, b = 0, Max(0);
- int inicio = 1, fin = 1;
- cin>>N;
- for(int i = 0; i < N; i++){
- cin>>x;
- if(!i)
- X = x;
- else if(X == x + 1)
- X = x, b++;//aumentamos el fin en 1
- else{
- if((b - a) > Max)
- Max = (b - a),
- inicio = a + 1, fin = b + 1;
- a = b = i;
- X = x;
- }
- }
- cout<<fin<<" "<<inicio;
- }
Add Comment
Please, Sign In to add comment