题目链接

最长上升子序列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))的更多相关文章

  1. poj 2533 Longest Ordered Subsequence(LIS)

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

  2. POJ 2533 Longest Ordered Subsequence LCS O(n*log(n))

    题目链接 最长上升子序列O(n*log(n))的做法,只能用于求长度不能求序列. #include <iostream> #define SIZE 1001 using namespace ...

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

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

  4. POJ 2533 Longest Ordered Subsequence(裸LIS)

    传送门: http://poj.org/problem?id=2533 Longest Ordered Subsequence Time Limit: 2000MS   Memory Limit: 6 ...

  5. POJ 2533 Longest Ordered Subsequence(LIS模版题)

    Longest Ordered Subsequence Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 47465   Acc ...

  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(LIS)

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

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

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

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

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

随机推荐

  1. 最长回文子串计算(fail)

    题意: 给定一个字符串s,在s中找到最长的回文子字符串.您可以假设s的最大长度为1000. 例子: 输入: “babad” 输出: “bab” 注: “aba”也是一个有效的答案. 我的答案: 想法: ...

  2. Java中I/O流之Print流

    Java 中的 print 流: print 流用于做输出将会非常的方便,并且具有以下特点: 1. printWriter.printStream 都属于输出流,分别针对字符,字节. 2. print ...

  3. IE BHO的IObjectWithSite接口

    Internet Explorer的BHO的对象必须实现IObjectWithSite接口.该接口是IE用来对插件进行管理和通讯的一个接口,其有SetSite和GetSite两个方法,当IE加载和卸载 ...

  4. Luogu1731 NOI1999生日蛋糕(搜索)

    非常经典的剪枝题然而一直没有写.感觉自己连普及组水平都没有了. 1.半径和高枚举范围满足加上后总体积不超过n且剩下每层还能放. 2.半径从大到小枚举,因为体积正比于半径平方而面积正比于半径,大的半径更 ...

  5. [JSOI2007]重要的城市 floyd:最短路计数

    ---题面--- 题解: 其实感觉还是比较妙的,第一眼看题想到floyd统计最短路条数, 注意到对于任意两点x,y而言,floyd将会枚举其最短路所可能经过的所有中转点, 因此我们可以直接分别统计对于 ...

  6. POJ3041:Asteroids——题解

    http://poj.org/problem?id=3041 题目大意:激光可以干掉一整行或一整列陨石,求最少激光次数. —————————————————— 二分图匹配,对于每一个陨石将它的横纵坐标 ...

  7. [Leetcode] Construct binary tree from inorder and postorder travesal 利用中序和后续遍历构造二叉树

    Given inorder and postorder traversal of a tree, construct the binary tree. Note:  You may assume th ...

  8. 洛谷 P4964 绫小路的特别考试 解题报告

    P4964 绫小路的特别考试 题目背景 这世界上「胜利」便是一切.无关乎过程. 要付出多少牺牲都无所谓.只要最后我「胜出」那就行了. 题目描述 一场新的特别考试来临了,这次的考试内容是(wan e d ...

  9. UVALive.2995 Image Is Everything (思维题 三维坐标转换)

    UVALive.2995 Image Is Everything (思维题 三维坐标转换) 题意分析 这题实在是没思路,就照着打了一遍,把不理解的地方,写了注释. #include <iostr ...

  10. Navcat中Oracle连接的坑-Instant Client

    报错信息: 官方下载Instant Client下载: http://www.oracle.com/technetwork/cn/topics/intel-macsoft-102027-zhs.htm ...