Cod sursa(job #1377738)
| Utilizator | Data | 6 martie 2015 00:32:18 | |
|---|---|---|---|
| Problema | Subsir crescator maximal | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.62 kb |
#include <iostream>
#include <fstream>
#define nmax 100005
using namespace std;
int n, v[nmax], in=1, out=1, fin=1, pst, nr=1, i=1, lmax;
int main()
{
ifstream f("scmax.in");
f >> n;
for(int i=1; i<=n; i++)
f >> v[i];
while(i<=n){
pst=i;
while((i<n) && (v[i]<v[i+1]))
i++;
fin=i;
nr=fin-pst+1;
if(nr>lmax){
lmax=nr;
in=pst;
out=fin;
}
i++;
}
ofstream g("scmax.out");
g << lmax << "\n";
for(i=in; i<=out; i++)
g << v[i] << " ";
return 0;
}
