#include #include #include using namespace std; const int oo=0x3f3f3f3f; const int maxn=1005; struct Node { int a,b; }; inline bool operator<(const Node &a,const Node &b) { return a.a0) { scanf("%d",&n); for(int i=0;i=0;i--) *lower_bound(dp,dp+n+1,p[i].b)=p[i].b; printf("%d\n",lower_bound(dp,dp+n+1,oo)-dp); } return 0; }