POJ 3903 && 1631 &&2533 最长上升子序列
来源:互联网 发布:网络安全法 税务系统 编辑:程序博客网 时间:2024/05/22 06:48
都是求最长递增子序列。
这里贴个模板。
POJ 1631.
#include <iostream>#include <cstdio>#include <algorithm>#include <string>#include <cmath>#include <cstring>#include <queue>#include <set>#include <vector>#include <stack>#include <map>#include <iomanip>#define PI acos(-1.0)#define Max 2005#define inf 1<<28using namespace std;int a[40005];int main(){ int i,j,k,l,m,n,T; cin>>T; while(T--) { cin>>n; int head=0; for(i=1; i<=n; i++) { scanf("%d",&k); if(head==0||k>a[head]) a[++head]=k; else { int high=head; int low=1; while(high>=low) { int mid=(high+low)/2; if(a[mid]<k) low=mid+1; else high=mid-1; } a[low]=k; } } cout<<head<<endl; } return 0;}
- POJ 3903 && 1631 &&2533 最长上升子序列
- poj 3903 最长上升子序列
- poj 3903(最长上升子序列 )
- POJ 3903-最长上升子序列
- poj 1631 最长上升子序列 nlogn
- POJ 1631(最长上升子序列 nlogn).
- poj 2533 最长上升子序列
- poj 2533 最长上升子序列
- poj 2533最长上升子序列
- poj 2533 最长上升子序列
- 最长上升子序列 nlogn poj 2533
- poj 2533 最长上升子序列
- 最长上升子序列 POJ 2533
- poj 2533 最长上升子序列
- POJ 2533 最长上升子序列
- POJ 3903 Stock Exchange 最长上升子序列
- poj 3903 最长上升子序列,nlog(n)的算法
- poj 3903 Stock Exchange (最长上升子序列)
- 知识点
- C++语言概念域检查(concept checking)
- 【统计】Oracle按天统计(详细)
- 抽象工厂
- java
- POJ 3903 && 1631 &&2533 最长上升子序列
- POJ 4048 Chinese Repeating Crossbow(点积加叉积和极角排序的两种做法)
- jsp中I18N国际化支持!
- Android资源文件使用小结(一)
- 程序员看世界之写给五年前的自己(8) 2012-8-13
- 存储过程1
- C++、WIN API、MFC分别遍历文件夹、获取文件名称的三种方式【耿然原创】
- eclipse/myeclipse注释模板的修改
- POJ 1434 Fill the Cisterns!(计算几何,二分)