Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
140558 林泽豪 最长不下降子序列 C++ 运行出错 30 1 MS 248 KB 310 2024-03-30 15:52:21

Tests(3/10):


#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; }


测评信息: