Pagini recente » Cod sursa (job #404434) | Cod sursa (job #2764460) | Cod sursa (job #1057923) | Cod sursa (job #627409) | Cod sursa (job #2944227)
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <deque>
#include <vector>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
using namespace std;
ifstream fin("scmax.in");
ofstream fout("scmax.out");
const int MAX_SIZE = 100000;
int v[MAX_SIZE + 1], dp[MAX_SIZE + 1];
int main() {
ios_base::sync_with_stdio(false);
int n;
fin >> n;
for (int i = 1; i <= n; ++i) {
fin >> v[i];
dp[i] = 1;
}
int maxLen = 1;
for (int i = 1; i <= n; ++i) {
for (int j = i - 1; j >= 0; --j) {
if (v[j] < v[i]) {
dp[i] = max(dp[i], dp[j] + 1);
}
}
maxLen = max(maxLen, dp[i]);
}
fout << maxLen;
}
/*
*/