Cod sursa(job #2446479)
Utilizator | Data | 9 august 2019 07:08:01 | |
---|---|---|---|
Problema | A+B | Scor | 0 |
Compilator | cpp-32 | Status | done |
Runda | teme_upb | Marime | 0.47 kb |
#include <iostream>
using namespace std;
int main()
{
int n,x1,x2,l,lmax,i,cnt=1,st,dr;
cin >> n >> x1;
l=lmax=1;
for(i=2;i<=n;i++)
{
cin >> x2;
if(x2>=x1)
l++;
else
{
if(l>lmax)
{
lmax=l;
dr=i-1;
st=dr-l+1;
}
l=1;
}
x1=x2;
}
if(l>lmax)
{lmax=l;dr=i+1;st=dr-l+1;}
cout<<lmax<<" "<<st<<" "<<dr<<"\n";
return 0;
}