Cod sursa(job #809232)

Utilizator ahmed.abdraboahmed.abdrabo ahmed.abdrabo Data 8 noiembrie 2012 03:45:38
Problema Subsir crescator maximal Scor 50
Compilator cpp Status done
Runda Arhiva educationala Marime 0.55 kb
#include <cstdio>
#include <set>
#include <map>
using namespace std;

inline int next_int() {
	int d;
	scanf("%d", &d);
	return d;
}

multiset<int> S;
multiset<int>::iterator it;
map<int, int> P;

void dfs(int x) {
	if (P.count(x) && P[x] >= 0) {
		dfs(P[x]);
	}
	printf("%d\n", x);
}

int main() {
	freopen("scmax.in", "r", stdin);
	freopen("scmax.out", "w", stdout);

	int n = next_int();
	while (n--) {
		int x = next_int();
		S.insert(x);
		it = S.lower_bound(x);
		if (++it != S.end()) {
			S.erase(it);
		}
	}
	printf("%d\n", int(S.size()));
	return 0;
}