poj 3903 Stock Exchange
来源:互联网 发布:工业自动化编程 编辑:程序博客网 时间:2024/05/22 15:44
//和2533是同一类的题目,都是简单的LIS题目,这题用二分+DP比较好,因为数据比较大!容易超时! #include <iostream>using namespace std;long num[100001], tmp[100001]; int main(){ int n, i, j, len, left, right, mid; while (cin >> n){ for (i = 0; i < n; i++){ cin >> num[i]; } memset(tmp, 0, sizeof(tmp)); len = 0; tmp[0] = -1; for (i = 0; i < n; i++){ if (num[i] > tmp[len]){ tmp[++len] = num[i]; } else{ left = 1, right = len; while (left <= right){ mid = (left + right) / 2; if (num[i] > tmp[mid]){ left = mid + 1; } else{ right = mid - 1; } } tmp[left] = num[i]; } } cout << len << endl; } system("pause"); }
- poj 3903 Stock Exchange
- POJ 3903 Stock Exchange
- POJ 3903 Stock Exchange
- 【POJ 3903】Stock Exchange
- POJ 3903 Stock Exchange
- poj 3903 Stock Exchange
- Poj 3903 Stock Exchange(LIS)
- Stock Exchange POJ 3903/ TOJ 3120
- Poj 3903 Stock Exchange(LIS)
- poj 3903 Stock Exchange
- POJ 题目3903 Stock Exchange(LIC)
- POJ 3903 Stock Exchange(LIS)
- POJ 3903 Stock Exchange(LIS)
- POJ 3903 Stock Exchange【LIS 二分查找】
- ACM篇:POJ 3903--Stock Exchange
- LIS问题(POJ - 3903 Stock Exchange)
- POJ 3903 Stock Exchange 最长上升子序列
- poj 3903 Stock Exchange (最长上升子序列)
- 检查网络连接状态,如果无连接,进行设置网络。
- linux查找符号文件以及其映射
- C#抽象类和接口的区别
- HDU 1203 I NEED A OFFER! ,01背包改编。
- HDOJ 2955Robberies(0 1 背包)
- poj 3903 Stock Exchange
- error LNK1123: failure during conversion to COFF的解决方法
- 大地测量员职业技能鉴定实操考核工作方案
- Flex入门(二)HelloWorld
- Coins 多重背包
- c++ premier -- 标准库类型
- mongodb启动不了
- hdu1851 A Simple Game-----sg
- 从深度缓冲里重建位置信息