九度 1533 最长上升子序列
2014-05-06 12:21
169 查看
/* * LIS.cpp * * Created on: 2014-5-6 * Author: wangzhu */ #include<cstdio> #include<iostream> #include<algorithm> using namespace std; #define NMAX 100001 int num[NMAX], arr[NMAX]; bool cmp(int a, int b) { return a < b; } int main() { // freopen("data.in", "r", stdin); int t, j, len; while (~scanf("%d", &t)) { for (int i = 0; i < t; i++) { scanf("%d", num + i); } len = 0; for (int i = 0; i < t; i++) { //查找当前数组中的数在上升序列中的位置 j = lower_bound(arr, arr + len, num[i], cmp) - arr; arr[j] = num[i]; len = max(j + 1, len); } printf("%d\n", len); } return 0; }
相关文章推荐
- 九度oj-1533 最长上升子序列 (LIS)
- 九度 1533:最长上升子序列
- 九度OJ 1500 出操队形 -- 动态规划(最长上升子序列)
- 九度OJ 1533 最长上升子序列 -- 动态规划
- 九度OJ 1533 最长上升子序列 -- 动态规划
- 九度OJ 1533 最长上升子序列 (基于贪心和二分查找)
- 题目1533:最长上升子序列
- [poj 1533]最长上升子序列nlogn树状数组
- 题目1533:最长上升子序列-九度
- 九度OJ 1500 出操队形 -- 动态规划(最长上升子序列)
- BestCoder Round #84 1002 hdu 5748 最长上升子序列
- 动态规划——最长上升子序列
- ZOJ 1076 最长上升子序列
- HDU 5773 最长上升子序列
- hdu3308 LCIS--区间更新 & 最长连续上升子序列
- 最长上升子序列问题LIS
- YTU.3135: 动态规划基础题目之最长上升子序列
- hdu 1423 dp 求最长公共上升子序列
- 最长上升子序列tyvj1049
- 求最长的上升子序列