Pagini recente » Cod sursa (job #1352678) | Cod sursa (job #2856933) | Cod sursa (job #2473015) | Cod sursa (job #1441635) | Cod sursa (job #728434)
Cod sursa(job #728434)
#include<stdio.h>
using namespace std;
int pi=1,l=1,n,i,lmax=1;
long long a[100000];
int main()
{
freopen("scmax.in","r",stdin);
freopen("scmax.out","w",stdout);
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%lld",&a[i]);
for(i=1;i<n;i++)
{
if(a[i]<=a[i+1])
l++;
else l=1;
if(l>=lmax)
{
pi=i-l+2;
lmax=l;
}
}
printf("%d\n",lmax);
for(i=pi;i<=pi+lmax-1;i++)
printf("%lld ",a[i]);
return 0;
}