Cod sursa(job #2243866)

Utilizator cosmin.pascaruPascaru Cosmin cosmin.pascaru Data 21 septembrie 2018 16:10:54
Problema Subsir crescator maximal Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 1.31 kb
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <array>
#include <algorithm>
#include <vector>
#include <stack>
#include <assert.h>
  
using LL = long long;
using ULL = int long long;
  
const std::string _problemName = "scmax";
  
namespace std {
    std::ifstream fin(_problemName + ".in"); 
    std::ofstream fout(_problemName + ".out"); 
}
  
#define cin fin
#define cout fout

std::vector<int> computeLongestIncreasingSubsequence(const std::vector<int>& v) {
    vector<int> best(v.size());
    vector<int> prev(v.size());
    vector<int> state;

    for (int currIdx = 0; currIdx < v.size(); ++currIdx) {
        int bestStateIdx = ;

        if (bestStateIdx >= state.size()) {
            state.push_back(currIdx);
        }
        else {
            state[bestStateIdx] = currIdx;
        }

        prev[currIdx] = bestStateIdx ? state[bestStateIdx - 1] : 0;        
    }
}

int main() {

    int n;
    std::cin >> n;

    std::vector<int> v(n);

    for (int idx = 0; idx < n; ++idx) {
        std::cin >> v[idx];
    }

    std::vector<int> lis = computeLongestIncreasingSubsequence(v);

    std::cout << lis.size() << '\n'
    for (auto i : lis) {
        std::cout << i << ' ';
    }
    std::cout << '\n';


    return 0;
}