poj3903 Stock Exchange 二分+dp
题目地址:http://poj.org/problem?id=3903
题目:
Description
Input
White spaces can occur freely in the input. The input data are correct and terminate with an end of file.
Output
For each set of data the program prints the result to the standard output from the beginning of a line.
Sample Input
6
5 2 1 4 5 3
3
1 1 1
4
4 3 2 1
Sample Output
3
1
1
Hint
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
#define PI acos((double)-1)
#define E exp(double(1))
const int K=+;
int a[K],c[K];
int main(void)
{
int n,cnt;
while(cin>>n)
{
cnt=;
memset(c,,sizeof(c));
for(int i=; i<=n; i++)
scanf("%d",&a[i]);
for(int i=;i<=n;i++)
{
int d=lower_bound(c+,c++cnt,a[i])-c;
c[d]=a[i];
cnt=max(cnt,d);
}
cout<<cnt<<endl;
}
return ;
}
poj3903 Stock Exchange 二分+dp的更多相关文章
- POJ3903 Stock Exchange LIS最长上升子序列
POJ3903 Stock Exchange #include <iostream> #include <cstdio> #include <vector> #in ...
- poj3903 Stock Exchange(最长上升子序列)
转载请注明出处:http://blog.csdn.net/u012860063 题目链接:id=3903">http://poj.org/problem?id=3903 Descrip ...
- POJ 3903:Stock Exchange(裸LIS + 二分优化)
http://poj.org/problem?id=3903 Stock Exchange Time Limit: 1000MS Memory Limit: 65536K Total Submis ...
- POJ3903:Stock Exchange(LIS)
题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87125#problem/E 题目: Description The world ...
- POJ 3903 Stock Exchange
Stock Exchange Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2954 Accepted: 1082 De ...
- POJ 3903 Stock Exchange (E - LIS 最长上升子序列)
POJ 3903 Stock Exchange (E - LIS 最长上升子序列) 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action ...
- 二分+DP HDU 3433 A Task Process
HDU 3433 A Task Process Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/ ...
- POJ - 3903 Stock Exchange(LIS最长上升子序列问题)
E - LIS Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Descripti ...
- hdu 3433 A Task Process 二分+dp
A Task Process Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) T ...
随机推荐
- EasyUI简单CRUD
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head> < ...
- 【转】CStdioFile UNICODE编译 英文系统下读取中文汉字乱码解决
转载出处:http://www.cnblogs.com/ct0421/p/3242418.html 函数原形为:char *setlocale( int category, const char *l ...
- 一次显式GC导致的High CPU问题处理过程(转)
项目现场反馈系统出现性能问题,具体表现为:所有的客户端响应极其卡顿. 第一反应推测,难道是DB层面出现阻塞?检查v$session会话状态及等待类型未见异常,应该可以排除DB层面原因导致的可能. 继续 ...
- 关于sqlSessionTemplate
SqlSessionTemplate是MyBatis-Spring的核心.这个类负责管理MyBatis的SqlSession,调用MyBatis的SQL方法,翻译异常.SqlSessionTempla ...
- [MySQL] 变量(参数)的查看和设置 [转]
[MySQL] 变量(参数)的查看和设置 类似于Oracle的参数文件,MySQL的选项文件(如my.cnf)用于配置MySQL服务器,但和Oracle叫法不一样,在MySQL里, 官方叫变量(Var ...
- hdu4565(矩阵快速幂+经典的数学处理)
注意题目的一个关键条件(a-1)2< b < a2 , 于是可以知道 0 < a-√b < 1 ,所以 (a-√b)^n < 1 . 然后 (a+ √b)^n+(a ...
- SqlBulkCopy 通过泛型数组批量插入
public void SqlBulkCopy<T>(string tablename, List<T> list) { Type recordType = typeof(T) ...
- 【BZOJ4592】[Shoi2015]脑洞治疗仪 线段树
[BZOJ4592][Shoi2015]脑洞治疗仪 Description 曾经发明了自动刷题机的发明家SHTSC又公开了他的新发明:脑洞治疗仪--一种可以治疗他因为发明而日益增大的脑洞的神秘装置. ...
- [Vue warn]: Missing required prop: "title"
在写vue项目中,在子组件中通过props传值的时候,在父组件中没有定义的话就会看到类似的报错, 这个意思是calendar这个组件中通过props传递一个title属性给父组件,并且title属性是 ...
- 160704、commons-beanutils.jar常用方法
package com.test.beanutils; import java.lang.reflect.InvocationTargetException;import java.text.Pars ...