//贪心加dp
#include<iostream>
using namespace std ;
const int N=;
int n;
int q[N];
int f[N];
int g[N];//存每个序列末尾的数字
int main() {
while(cin>>q[n]) n++;
int res=;
for(int i=; i<n; i++) {
f[i]=;
for(int j=; j<i; j++) {
if(q[j]>=q[i])
f[i]=max(f[i],f[j]+);
res=max(res,f[i]);
}
}
cout<<res<<endl;
int cnt=;//表示序列个数
for(int i=; i<n; i++) {
int k=;//表示已经遍历的序列的个数
while(k<cnt&&g[k]<q[i])//没有遍历完所有序列,而且序列最后小于q[i]
k++;//往后找
g[k]=q[i];//当上述循环结束的时候,要么遍历完所有数组,要么找到了小于的
if(k>=cnt) cnt++;//第一次k为0,cnt为0 所以直接 g[k]=q[i]
//因为此时k>=cnt 所以cnt++ 即有一个序列
}
cout<<cnt<<endl;
return ;
}

最新文章

  1. 考查SQLite 3索引对整数排序的性能影响
  2. oracle procedure
  3. jQuery waterbubble 水球图
  4. iOS 抽象工厂模式
  5. 边工作边刷题:70天一遍leetcode: day 78
  6. SU sufdmod2命令学习
  7. Excel Xll开发资料
  8. HTTP Digest authentication
  9. 解析Tensorflow官方English-Franch翻译器demo
  10. javascript学习初衷
  11. WinRarHelper帮助类
  12. Workbooks 对象的 Open 方法参数说明
  13. Oracle查询语句导致CPU使用率过高问题处理
  14. 自动获取svn的版本号
  15. ObjectArx2013新建工程出错的解决办法
  16. 万恶的deferred_segment_creation(延迟块分配)
  17. selenium基础-打开百度进行搜索
  18. git命令将本地代码提交到github
  19. The value of &#39;filter_horizontal[0]&#39; must be a many-to-many field. The value of &#39;raw_id_fields[0]&#39; must be a foreign key or a many-to-many field.
  20. DK NIO的BUG,例如臭名昭著的epoll bug,它会导致Selector空轮询,最终导致CPU 100%。

热门文章

  1. Kafka消费者没有收到通知的分析
  2. ES6常用语法(二)
  3. 搭建网页HTML结构
  4. BZOJ2005: [Noi2010]能量采集(欧拉函数)
  5. Count the Colors ZOJ - 1610 区间颜色覆盖
  6. hibernate报错:MappingException: Could not determine type for...解决办法
  7. Python带你来一次说走就走的环球旅行
  8. 剑指offer-面试题17-打印从1到最大的n位数-数字
  9. openlayers画区域
  10. Linux之docker搭建