Cod sursa(job #2466982)
| Utilizator | Data | 3 octombrie 2019 14:28:13 | |
|---|---|---|---|
| Problema | Subsir crescator maximal | Scor | 65 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <bits/stdc++.h>
using namespace std;
multiset<int> M;
multiset<int>:: iterator it;
int N;
int main() {
freopen("scmax.in", "r", stdin);
freopen("scmax.out", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int i, x;
cin >> N;
for(int i = 1; i <= N; i++)
{
cin >> x;
M.insert(x);
it = M.lower_bound(x);
++it;
if(it != M.end()) M.erase(it);
}
cout << M.size() << '\n';
for(auto value : M) cout << value << ' ';
return 0;
}
