标签:
Description
Input
Output
Sample Input
6 5 2 1 4 5 3 3 1 1 1 4 4 3 2 1
Sample Output
3 1 1
Hint
#include<cstdio> #include<algorithm> #include<iostream> using namespace std; const int INF=100050; int a[100047],dp[100047]; int main(){ int t,i; while(scanf("%d",&t)!=EOF){ for(i = 0; i <= t; i++)dp[i]=INF; for(i = 0; i < t; i++)scanf("%d",&a[i]); for(i = 0; i < t; i++){ *lower_bound(dp,dp+t,a[i])=a[i]; } printf("%d\n",lower_bound(dp,dp+t,INF)-dp); } return 0; }
标签:
原文地址:http://www.cnblogs.com/demodemo/p/4732525.html