Pagini recente » Cod sursa (job #1546357) | Cod sursa (job #464835) | Cod sursa (job #2022529) | Statistici serediuc constantin (serediucctin) | Cod sursa (job #1010730)
#include<iostream>
#include<fstream>
using namespace std;
int main()
{long n,v[100001],i,w[100001],max=0,y,x,j;
ifstream f("scmax.in");
ofstream g("scmax.out");
f>>n>>x;
y=1;
v[1]=x;
for(i=2;i<=n;i++)
{f>>x;
if(x>v[y])
{y++;
v[y]=x;}
else
if(x<v[y])
{y=1;
v[y]=x;
}
if(max<y)
{max=y;
for(j=1;j<=max;j++)
w[j]=v[j];
}
}
g<<max<<"\n";
for(i=1;i<=max;i++)
g<<w[i]<<" ";
f.close();
g.close();
}