POJ 2533 Longest Ordered Subsequence LIS O(n*log(n))
最长上升子序列O(n*log(n))的做法,只能用于求长度不能求序列。
#include <iostream>
#include <algorithm>
using namespace std;
const int N=;
int s[N],x;
int main()
{
int n;
while(cin>>n){
int top=;
for(int i=;i<n;i++){
cin>>x;
if(top==||s[top-]<x) s[top++]=x;
else s[upper_bound(s,s+top,x)-s]=x;
}
cout<<top<<endl;
}
return ;
}
POJ 2533 Longest Ordered Subsequence LIS O(n*log(n))的更多相关文章
- poj 2533 Longest Ordered Subsequence(LIS)
Description A numeric sequence of ai is ordered ifa1 <a2 < ... < aN. Let the subsequence of ...
- POJ 2533 Longest Ordered Subsequence LCS O(n*log(n))
题目链接 最长上升子序列O(n*log(n))的做法,只能用于求长度不能求序列. #include <iostream> #define SIZE 1001 using namespace ...
- poj 2533 Longest Ordered Subsequence 最长递增子序列
作者:jostree 转载请注明出处 http://www.cnblogs.com/jostree/p/4098562.html 题目链接:poj 2533 Longest Ordered Subse ...
- POJ 2533 Longest Ordered Subsequence(裸LIS)
传送门: http://poj.org/problem?id=2533 Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 6 ...
- POJ 2533 Longest Ordered Subsequence(LIS模版题)
Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 47465 Acc ...
- POJ 2533 - Longest Ordered Subsequence - [最长递增子序列长度][LIS问题]
题目链接:http://poj.org/problem?id=2533 Time Limit: 2000MS Memory Limit: 65536K Description A numeric se ...
- Poj 2533 Longest Ordered Subsequence(LIS)
一.Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequenc ...
- POJ - 2533 Longest Ordered Subsequence与HDU - 1257 最少拦截系统 DP+贪心(最长上升子序列及最少序列个数)(LIS)
Longest Ordered Subsequence A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let ...
- 题解报告:poj 2533 Longest Ordered Subsequence(最长上升子序列LIS)
Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence ...
随机推荐
- iOS- <项目笔记> UIApplication常见属性与方法总结
UIApplication 1.简介 1> 整个应用程序的象征,一个应用程序就一个UIApplication对象,使用了单例设计模式 2> 通过[UIApplication sharedA ...
- <Effective C++>读书摘要--Templates and Generic Programming<一>
1.The initial motivation for C++ templates was straightforward: to make it possible to create type-s ...
- OSG配置捷径,VS2013+WIN10
在自己电脑上用CMAKE已经编译好了,上传到百度云里面了. 环境是WIN10+VS2013. 链接:http://pan.baidu.com/s/1hrO7GFE 密码:fwkw 解压之后放在C盘或者 ...
- phpcms找不到模板、空白模板的解决办法
有时候会出现这个问题,尤其是在调试模板的过程中,不知道别的朋友的操作习惯.我的习惯是,先保留一份原始的模板.比如: index原版.html. 以便对比之用.但是呢,这样,往往会造成 找不到模板的情况 ...
- html5 js canvas中画星星的函数
function drawStar(cxt, x, y, outerR, innerR, rot) { cxt.beginPath(); ; i < ; i++) { cxt.lineTo(Ma ...
- 【python】windows7下怎样安装whl
windows7 python2.7 1.用管理员方式打开cmd 2.首先通过pip命令安装wheel 如果提示’pip’不是内部或外部命令,也不是可运行的程序或批处理文件 ①将python安装目录下 ...
- Go语言【第四篇】:Go运算符
Go语言运算符 运算符用于在程序运行时执行数据或逻辑运算,Go语言内置的运算符有: 算数运算符 关系运算符 逻辑运算符 位运算符 赋值运算符 其他运算符 算数运算符 下表列出了所有Go语言的算数运算符 ...
- [LOJ2540] [PKUWC2018] 随机算法
题目链接 LOJ:https://loj.ac/problem/2540 Solution 写的时候脑子不太清醒码了好长然后时间\(LOJ\)垫底... 反正随便状压\(dp\)一下就好了,设\(f[ ...
- BZOJ1926:[SDOI2010]粟粟的书架——题解
http://www.lydsy.com/JudgeOnline/problem.php?id=1926 https://www.luogu.org/problemnew/show/P2468 幸福幼 ...
- BZOJ2152:聪聪可可——题解
http://www.lydsy.com/JudgeOnline/problem.php?id=2152 Description 聪聪和可可是兄弟俩,他们俩经常为了一些琐事打起来,例如家中只剩下最后一 ...