Poj 1887 Testing the CATCHER(LIS)】的更多相关文章

一.Description A military contractor for the Department of Defense has just completed a series of preliminary tests for a new defensive missile called the CATCHER which is capable of intercepting multiple incoming offensive missiles. The CATCHER is su…
Language: Default Testing the CATCHER Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 15207   Accepted: 5595 Description A military contractor for the Department of Defense has just completed a series of preliminary tests for a new defen…
Testing the CATCHER Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 13396   Accepted: 4905 Description A military contractor for the Department of Defense has just completed a series of preliminary tests for a new defensive missile calle…
题意:题目太长没看,直接看输入输出猜出是最长下降子序列 用了以前的代码直接a了,做法类似贪心,把最小的顺序数存在数组里面,每次二分更新数组得出最长上升子序列 #include<iostream> #include<cstdio> using namespace std; int main() { int dp[40002],a[40002],n,t,i,low,up,top,mid,max,tmp,k,b[40002],cas=1; while(1) { scanf("%…
POJ 1887Testingthe CATCHER (LIS:最长下降子序列) http://poj.org/problem?id=3903 题意: 给你一个长度为n (n<=200000) 的数字序列, 要你求该序列中的最长(严格)下降子序列的长度. 分析:        读取全部输入, 将原始数组逆向, 然后求最长严格上升子序列就可以. 因为n的规模达到20W, 所以仅仅能用O(nlogn)的算法求.        令g[i]==x表示当前遍历到的长度为i的全部最长上升子序列中的最小序列末…
Testing the CATCHER Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 16131   Accepted: 5924 Description A military contractor for the Department of Defense has just completed a series of preliminary tests for a new defensive missile calle…
Testing the CATCHER Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 13968   Accepted: 5146 Description A military contractor for the Department of Defense has just completed a series of preliminary tests for a new defensive missile calle…
Testing the CATCHER Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 16515 Accepted: 6082 Description A military contractor for the Department of Defense has just completed a series of preliminary tests for a new defensive missile called th…
Bridging signals Description 'Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the routing designers have screwed up completely, making the signals on the chip connecting the ports of two functional blo…
E - LIS Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u   Description The world financial crisis is quite a subject. Some people are more relaxed while others are quite anxious. John is one of them. He is very concerned a…
Description A numeric sequence of ai is ordered ifa1 <a2 < ... < aN. Let the subsequence of the given numeric sequence (a1,a2, ..., aN) be any sequence (ai1,ai2, ..., aiK), where 1 <=i1 < i2 < ... < iK <=N. For example, sequence (1…
题意:求最大上升子序列 思路:才发现自己不会LIS,用线段树写的,也没说数据范围就写了个离散化,每次查找以1~a[i]-1结尾的最大序列答案,然后更新,这样遍历一遍就行了.最近代码总是写残啊... 刚看了LIS的nlogn写法(贪心+二分):维护一个dp[i]表示最大长度为i时的最小结尾,初始memset为INF,最终dp数组的长度为答案.这个很好维护,如果当前的a[i]比dp[len]要大,那么显然最大长度加一,dp[len + 1] = a[i]:如果比dp[len]小,那么我就去二分查找前…
一.Description The world financial crisis is quite a subject. Some people are more relaxed while others are quite anxious. John is one of them. He is very concerned about the evolution of the stock exchange. He follows stock prices every day looking f…
把左边固定,看右边,要求线不相交,编号满足单调性,其实是LIS的等价表述. (如果编号是乱的也可以把它有序化就像Uva 10635 Prince and Princess那样 O(nlogn) #include<cstdio> #include<iostream> #include<string> #include<cstring> #include<queue> #include<vector> #include<stack&…
题意:求二维偏序的最少链划分. 用到Dilworth定理:最少链划分=最长反链.(对偶也成立,个人认为区别只是一个维度上的两个方向,写了个简单的证明 相关概念:偏序集,链,反链等等概念可以参考这里:http://www.cnblogs.com/fstang/archive/2013/03/31/2991220.html Dilworth定理的证明(英文的):http://aleph.math.louisville.edu/teaching/2009FA-681/notes-091119.pdf…
Language: Default Bridging signals Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 10762   Accepted: 5899 Description 'Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the routing designers…
题目大意:一种拦截导弹能拦截多枚导弹,但是它在每次拦截后高度不会再升高,给出导弹的序列,问最多能拦截多少枚导弹? 最长递减子序列问题. #include <cstdio> #include <vector> #include <algorithm> using namespace std; vector<int> m, lds; int main() { #ifdef LOCAL freopen("in", "r",…
题目链接 最长上升子序列O(n*log(n))的做法,只能用于求长度不能求序列. #include <iostream> #include <algorithm> using namespace std; ; int s[N],x; int main() { int n; while(cin>>n){ ; ;i<n;i++){ cin>>x; ||s[top-]<x) s[top++]=x; else s[upper_bound(s,s+top,…
Description The cows are so very silly about their dinner partners. They have organized themselves into three groups (conveniently numbered 1, 2, and 3) that insist upon dining together. The trouble starts when they line up at the barn to enter the f…
A POJ 1018 Communication System B POJ 1050 To the Max C POJ 1083 Moving Tables D POJ 1125 Stockbroker Grapevine E POJ 1143 Number Game F POJ 1157 LITTLE SHOP OF FLOWERS G POJ 1163 The Triangle H POJ 1178 Camelot I POJ 1179 Polygon J POJ 1189 钉子和小球 K…
Log 2016-3-21 网上找的POJ分类,来源已经不清楚了.百度能百度到一大把.贴一份在博客上,鞭策自己刷题,不能偷懒!! 初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. (5)构造法.(poj3295) (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996) 二.图算法: (1)图的深度优先遍历和广度优先遍历. (2)最短路…
初期:一.基本算法:     (1)枚举. (poj1753,poj2965)     (2)贪心(poj1328,poj2109,poj2586)     (3)递归和分治法.     (4)递推.     (5)构造法.(poj3295)     (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法:     (1)图的深度优先遍历和广度优先遍历.     (2)最短路径算法(dijkstra,bellman-ford,floyd,hea…
初期: 一.基本算法:      (1)枚举. (poj1753,poj2965)      (2)贪心(poj1328,poj2109,poj2586)      (3)递归和分治法.      (4)递推.      (5)构造法.(poj3295)      (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996) 二.图算法:      (1)图的深度优先遍历和广度优先遍历.      (2)最短路径算法(dijkstra,bellman-ford…
poj 题目分类 按照ac的代码长度分类(主要参考最短代码和自己写的代码) 短代码:0.01K--0.50K:中短代码:0.51K--1.00K:中等代码量:1.01K--2.00K:长代码:2.01K以上. 短:1147.1163.1922.2211.2215.2229.2232.2234.2242.2245.2262.2301.2309.2313.2334.2346.2348.2350.2352.2381.2405.2406: 中短:1014.1281.1618.1928.1961.2054…
本文来自:http://www.cppblog.com/snowshine09/archive/2011/08/02/152272.spx 多版本的POJ分类 流传最广的一种分类: 初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. (5)构造法.(poj3295) (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996) 二.图算法:…
初期:一.基本算法:     (1)枚举. (poj1753,poj2965)     (2)贪心(poj1328,poj2109,poj2586)     (3)递归和分治法.     (4)递推.     (5)构造法.(poj3295)     (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法:     (1)图的深度优先遍历和广度优先遍历.     (2)最短路径算法(dijkstra,bellman-ford,floyd,hea…
[1]POJ 动态规划题目列表 容易: 1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1208, 1276, 1322, 1414, 1456, 1458, 1609, 1644, 1664, 1690, 1699, 1740(博弈), 1742, 1887,1926(马尔科夫矩阵,求平衡), 1936, 1952, 1953, 1958, 1959, 1962, 1975, 1989, 2018, 2029,…
列表一:经典题目题号:容易: 1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1191,1208, 1276, 1322, 1414, 1456, 1458, 1609, 1644, 1664, 1690, 1699, 1740, 1742, 1887, 1926, 1936, 1952, 1953, 1958, 1959, 1962, 1975, 1989, 2018, 2029, 2039, 2063, 20…
acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  1024   Calendar Game       简单题  1027   Human Gene Functions   简单题  1037   Gridland            简单题  1052   Algernon s Noxious Emissions 简单题  1409   Commun…
]POJ 动态规划题目列表 容易: 1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1208, 1276, 1322, 1414, 1456, 1458, 1609, 1644, 1664, 1690, 1699, 1740(博弈), 1742, 1887, 1926(马尔科夫矩阵,求平 衡), 1936,1952, 1953, 1958, 1959, 1962, 1975, 1989, 2018, 2029,2…