#pragma GCC optimize(2)
#pragma GCC optimize(1)
#pragma GCC optimize(3)
#include<cstdio>
#include<algorithm>
using namespace std;
int Hight[100005],Ans=1,Dp[100005],New_Hight[100005];
int main(){
register int N=0;
while(scanf("%d",&Hight[N])==1) N++;
for(register int i=0;i<N;i++){
New_Hight[i]=3000001;
Dp[i]=1;
}
for(register int i=N;i<100005;i++) New_Hight[i]=3000001;
for(register int i=0;i<N;i++)
for(register int j=0;j<i;j++) if(Hight[i]<=Hight[j]) Dp[i]=max(Dp[j]+1,Dp[i]);
for(register int i=0;i<N;i++) Ans=max(Dp[i],Ans);
printf("%d\n",Ans);
Ans=0;
for(register int i=1;i<N;i++)
for(register int j=1;j<N;j++)
if(Hight[i]<=New_Hight[j]){
New_Hight[j]=Hight[i];
Ans=max(j,Ans);
break;
}
printf("%d",Ans);
return 0;
}
其实是来求注的,TLE10个点,呵呵,呵呵,呵呵。
呜呜呜,我居然TLE了,大佬有没有优化