提交时间:2024-03-30 15:52:21
运行 ID: 140558
#include<bits/stdc++.h> using namespace std; const int N=1100; int w[N],f[N],maxn=0,top; int main(){ int n; cin>>n; for(int i=1;i<=n;i++)cin>>w[i]; for(int i=1;i<=n;i++){ if(f[top]<=w[i])f[++top]=w[i]; else { int j=upper_bound(f+1,f+1+top,w[i])-f; f[j]=w[i]; } } cout<<top; }