CodeForces

来源:互联网 发布:网络上的 古是什么意思 编辑:程序博客网 时间:2024/05/22 13:26

教育场,当真是叫人受教育

此场 1 题滚出

这个 A 题也是很傻逼,可能是因为最近做题不够,思考不够

这个题显然的是求 最长上升子序列


#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <string>#include <cmath>#include <set>#include <map>#include <stack>#include <queue>#include <ctype.h>#include <vector>#include <algorithm>#include <sstream>#define PI acos(-1.0)#define in freopen("in.txt", "r", stdin)#define out freopen("out.txt", "w", stdout)using namespace std;typedef long long ll;const int maxn = 100 + 7, INF = 0x3f3f3f3f, mod = 1e9 + 7;int n;int a[maxn];int b[maxn];int main() {    scanf("%d", &n);    int x;    for(int i = 0; i < n; ++i) {        scanf("%d", &a[i]);    }    memset(b, INF, sizeof b);    for(int i = 0; i < n; ++i) {        *upper_bound(b, b+maxn, a[i]) = a[i];    }    int ans = lower_bound(b, b+maxn, INF) - b;    cout << ans << endl;    return 0;}