题意:最长上升子序列nlogn写法

 #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int dp[];
int a[];
int main(){
int n;
while(cin>>n){
for(int i=;i<n;i++){
cin>>a[i];
}
memset(dp,,sizeof(dp));
dp[]=a[];
int flag=;
for(int i=;i<n;i++){
int temp=lower_bound(dp,dp+flag,a[i])-dp;
if(dp[flag]<a[i]){
dp[++flag]=a[i];
}
else if(a[i]<dp[temp]){
dp[temp]=a[i];
}
}
cout<<flag<<endl;
}
return ;
}

Longest Ordered Subsequence POJ - 2533 最长上升子序列dp的更多相关文章

  1. Longest Ordered Subsequence POJ - 2533 dp 最长上升/不下降 子序列

    #include<iostream> using namespace std ; ; int f[N]; int a[N]; int n; int main() { cin>> ...

  2. POJ - 2533 Longest Ordered Subsequence与HDU - 1257 最少拦截系统 DP+贪心(最长上升子序列及最少序列个数)(LIS)

    Longest Ordered Subsequence A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let ...

  3. POJ 1458 最长公共子序列(dp)

    POJ 1458 最长公共子序列 题目大意:给出两个字符串,求出这样的一 个最长的公共子序列的长度:子序列 中的每个字符都能在两个原串中找到, 而且每个字符的先后顺序和原串中的 先后顺序一致. Sam ...

  4. Common Subsequence POJ - 1458 最长公共子序列 线性DP

    #include <iostream> #include <algorithm> #include <string> #include <cstring> ...

  5. poj 2533 Longest Ordered Subsequence 最长递增子序列

    作者:jostree 转载请注明出处 http://www.cnblogs.com/jostree/p/4098562.html 题目链接:poj 2533 Longest Ordered Subse ...

  6. POJ 2533 - Longest Ordered Subsequence - [最长递增子序列长度][LIS问题]

    题目链接:http://poj.org/problem?id=2533 Time Limit: 2000MS Memory Limit: 65536K Description A numeric se ...

  7. POJ 2533 Longest Ordered Subsequence 最长递增序列

      Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequenc ...

  8. 题解报告:poj 2533 Longest Ordered Subsequence(最长上升子序列LIS)

    Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence ...

  9. 【POJ - 2533】Longest Ordered Subsequence (最长上升子序列 简单dp)

    Longest Ordered Subsequence 搬中文 Descriptions: 给出一个序列,求出这个序列的最长上升子序列. 序列A的上升子序列B定义如下: B为A的子序列 B为严格递增序 ...

随机推荐

  1. PM2用法简介

    简介 PM2是node进程管理工具,可以利用它来简化很多node应用管理的繁琐任务,如性能监控.自动重启.负载均衡等,而且使用非常简单.引用 全局安装 sudo npm install pm2@lat ...

  2. Python-序列化模块-json-62

    序列化模块 Eva_J 什么叫序列化——将原本的字典.列表等内容转换成一个字符串的过程就叫做序列化. 比如,我们在python代码中计算的一个数据需要给另外一段程序使用,那我们怎么给? 现在我们能想到 ...

  3. CentOS 7.2 yum安装LAMP环境

    https://www.linuxidc.com/Linux/2016-11/136766.htm 详见以上链接,用yum安装方便省事. 尤其注意,mysql数据要设置远程连接.

  4. 【学习总结】Git学习-参考廖雪峰老师教程十-自定义Git

    学习总结之Git学习-总 目录: 一.Git简介 二.安装Git 三.创建版本库 四.时光机穿梭 五.远程仓库 六.分支管理 七.标签管理 八.使用GitHub 九.使用码云 十.自定义Git 期末总 ...

  5. 阿里云ECS服务器云监控(cloudmonitor)Go语言版本插件安装卸载与维护

    云监控Go语言版本插件安装_主机监控_用户指南_云监控-阿里云https://help.aliyun.com/document_detail/97929.html 云监控cloudmonitor 1. ...

  6. React Native之微信分享(iOS Android)

    React Native之微信分享(iOS Android) 在使用React Native开发项目的时候,基本都会使用到微信好友或者微信朋友圈分享功能吧,那么今天我就带大家实现以下RN微信好友以及朋 ...

  7. [转帖]CentOS 查看系统信息汇总

    CentOS 查看系统信息汇总 http://blog.itpub.net/15498/viewspace-2637493/ 感觉应该是 centos相关的 改了下名字 日志文件说明 /var/log ...

  8. Notepad++ 安装 NppFTP 插件

    How to install a plugin The plugin (in the DLL form) should be placed in the \plugins subfolder of t ...

  9. innerText兼容问题处理

    IE.Safari.Opera和Chrome支持innerText属性.低版本的火狐浏览器不支持,但支持作用类似的textContent属性.textContent是DOM3级规定的一个属性,而且也得 ...

  10. snv的使用

    1.搭建SVN服务器 (1)直接安装 (2)创建工号,分组,分配权限(图形化界面的直接操作,非图形界面的需要改配置文件conf文件夹下) (3)创建仓库,D:\Repositories\OA:cmd命 ...