poj 1631 LIS
题目链接:http://poj.org/problem?id=1631
#include <cstdio> #include <cstring> #include <iostream> #include <cmath> #include <algorithm> #include <queue> #include <vector> using namespace std; const int maxe = 50000; const int maxn = 40050; const int INF = 0x3f3f3f; int main() { //freopen("E:\\acm\\input.txt","r",stdin); int T; cin>>T; while(T--){ int A[maxn]; int g[maxn]; //memset(dp,0,sizeof(dp)); memset(g,0x3f,sizeof(g)); int n; cin>>n; for(int i=1;i<=n;i++) scanf("%d",&A[i]); int ans = 0; for(int i=1;i<=n;i++){ int k = lower_bound(g+1,g+n,A[i]) - g; g[k] = A[i]; //dp[i] = k; ans = max(ans,k); } printf("%d\n",ans); } }