Cod sursa(job #3208297)

Utilizator tudorhorotanHorotan Tudor tudorhorotan Data 28 februarie 2024 10:46:05
Problema Subsir crescator maximal Scor 0
Compilator cpp-64 Status done
Runda 28_februarie_simulare_oji_2024_clasele_11_12 Marime 0.59 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("scmax.in");
ofstream fout("scmax.out");

int v[10000001];
int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> v[i];
    }
    int lgmax = 0;
    for (int i = 1; i < n; ++i) {
        int lg = 1;
        int aux = v[i];
        for (int j = i + 1; j <= n; ++j) {
            if (v[j] > aux) {
                aux = v[j];
                ++lg;
            }
        }
        if (lg > lgmax) {
            lgmax = lg;
        }
    }
    cout << lgmax;
    return 0;
}