Cod sursa(job #3347706)

Utilizator moloDaniMolodet Andrei Daniel moloDani Data 17 martie 2026 22:44:16
Problema Subsir crescator maximal Scor 5
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.42 kb
#include <fstream>

using namespace std;

ifstream fin ("scmax.in");
ofstream fout ("scmax.out");

const int mxN = 2e5 + 1;

int dp[mxN], n;

int main(){
    int max = 0, aux;
    fin >> n;

    for(int i = 1; i <= n; i++){
        fin >> aux;
        if(dp[max] < aux)
            dp[++max] = aux;

        for(int j = 1; j <= max; j++){
            if(dp[j] > aux)
                dp[j] = aux;
        }
    }

    fout << max;
}