/* * LIS.cpp * * Created on: 2014-5-6 * Author: wangzhu */ #include<cstdio> #include<iostream> #include<algorithm> using namespace std; #define NMAX 100001 int num[NMAX], arr[NMAX]; bool cmp(int a, int b) { return a < b; } int main() { // freopen("data.in", "r", stdin); int t, j, len; while (~scanf("%d", &t)) { for (int i = 0; i < t; i++) { scanf("%d", num + i); } len = 0; for (int i = 0; i < t; i++) { //查找当前数组中的数在上升序列中的位置 j = lower_bound(arr, arr + len, num[i], cmp) - arr; arr[j] = num[i]; len = max(j + 1, len); } printf("%d ", len); } return 0; }