最长最长上升子序列nlogn模板
//
// Created by luozujian on 17-11-14.
//
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<queue>
#include<cmath>
#include<stack>
#define INF 0x3f3f3f3f
using namespace std;
const int maxn = 4e4+5;
int a[maxn];
int dp[maxn]; //以某一个为结尾的最长上升子序列
int p;
void solve()
{
fill(dp,dp+p,INF);
for(int i=0;i<p;i++)
{
*lower_bound(dp,dp+p,a[i]) = a[i];
}
printf("%d\n",lower_bound(dp,dp+p,INF) - dp);
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
scanf("%d",&p);
for(int i=0;i<p;i++)
{
scanf("%d",&a[i]);
}
solve();
}
return 0;
}
//找数字的最长上升子序列