http://poj.org/problem?id=2533

在经典不过的DP题目了。。。。

 #include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
#define INF 0x3f3f3f3f
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
#define mem0(a) memset(a,0,sizeof(a)) typedef long long LL;
const double eps = 1e-;
const int MAXN = ;
const int MAXM = ; int DP[], a[], N; int BinarySearch(int low, int high, int val)
{
while(low < high)
{
int mid = (low + high) >> ;
if(DP[mid] < val) low = mid +;
else high = mid;
}
return low;
} int main()
{
while(~scanf("%d", &N))
{
for(int i=;i<=N;i++)
{
scanf("%d", &a[i]);
}
DP[] = a[];
int len = ;
for(int i=;i<=N;i++)
{
int id = BinarySearch(, len+, a[i]);
DP[id] = a[i];
if(id > len) ++len;
}
printf("%d\n", len);
}
return ;
}

POJ2533Longest Ordered Subsequence(DP)的更多相关文章

  1. poj2533--Longest Ordered Subsequence(dp:最长上升子序列)

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

  2. POJ 2533-Longest Ordered Subsequence(DP)

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

  3. POJ 2533——Longest Ordered Subsequence(DP)

    链接:http://poj.org/problem?id=2533 题解 #include<iostream> using namespace std; ]; //存放数列 ]; //b[ ...

  4. POJ 2533 Longest Ordered Subsequence(DP 最长上升子序列)

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

  5. POJ 2533 Longest Ordered Subsequence(dp LIS)

    Language: Default Longest Ordered Subsequence Time Limit: 2000MS   Memory Limit: 65536K Total Submis ...

  6. Poj 2533 Longest Ordered Subsequence(LIS)

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

  7. poj-2533 longest ordered subsequence(动态规划)

    Time limit2000 ms Memory limit65536 kB A numeric sequence of ai is ordered if a1 < a2 < ... &l ...

  8. HPU第三次积分赛-D:Longest Increasing Subsequence(DP)

    Longest Increasing Subsequence 描述 给出一组长度为n的序列,a1​,a2​,a3​,a4​...an​, 求出这个序列长度为k的严格递增子序列的个数 输入 第一行输入T ...

  9. HDU 1159 Common Subsequence (dp)

    题目链接 Problem Description A subsequence of a given sequence is the given sequence with some elements ...

随机推荐

  1. volley(4) 请求参数:data:[ { bar_remain:XX , bar_code:"XX" , bar_id: XX}], method:GET

    1. 来自于WHCombineBatchFragment.java 2.部分代码 ).).).).port + Url.LABELPRINT + "?data="+strPrint ...

  2. python处理ajax请求

    先要起一个服务 server.py,可以支持python的cgi脚本. #!coding:utf8 from BaseHTTPServer import HTTPServer from CGIHTTP ...

  3. BZOJ 1977 次小生成树

    TM终于过了.... #include<iostream> #include<cstdio> #include<cstring> #include<algor ...

  4. webstorm查看angular2的ts源码

    1.shift双击 双击shift就可以查找文件或函数了,速度更快更方便. 2.ng_for.ts

  5. 实用js+css多级树形展开效果导航菜单

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. GitHub入门:如何上传与下载工程?

    由于经常要在家写代码,所以需要有个能够方便访问代码管理工具.最近尝试了一下GitHub.经过了一翻纠结之后,基本上掌握了他的使用方式.  要使用GitHub需要首先在其网站上进行注册.其官方网站是ht ...

  7. MIME邮件格式

    转自:http://kptu.iteye.com/blog/890180 排版做了调整. Q.什么是MIME?什么是MIME邮件? A. MIME, 全称为"Multipurpose Int ...

  8. 【树莓派2B倒腾日志】之安装系统及配置

    15号树莓派到手到现在,折腾了也有一小周,自己摸索着,装了系统,登上SSH,更新了源,连了VNC,换上wifi,亮了小灯.再到今天捣鼓了下数码管,回头想想,该写个日志记录一下这一周的所得,自己总结也方 ...

  9. [python]Python操作MySQL

    [安装] 安装MySQL 安装MySQL不用多说了,下载下来安装就是,没有特别需要注意的地方. 一个下载地址:点击打开链接 [样例] ? 1 2 3 4 5 6 7 8 9 10 11 12 13 1 ...

  10. ASP.NET MVC Razor视图引擎攻略

    --引子 看下面一段MVC 2.0的代码. <%if (Model != null){%> <p><%=Model%></p><%}%>&l ...