DescriptionQuestion 1: Is Bigger Smarter?The ProblemSome people think that the bigger an elephant is, the smarter it is. To disprove this, you want to...
分类:
其他好文 时间:
2014-08-06 14:39:11
阅读次数:
242
DescriptionStacking BoxesBackgroundSome concepts in Mathematics and Computer Science are simple in one or two dimensions but become more complex when ...
分类:
其他好文 时间:
2014-08-06 01:32:20
阅读次数:
275
题意:给你一系列个w,s,要你找到最长的n使得
W[m[1]]
and
S[m[1]] > S[m[2]] > ... > S[m[n]]
即在这n个w,s中满足w[i]s[j],要求:体重严格递增,速度严格递减,原始顺序不定
首先将s从大到小排序,即顺数固定后转化为最长上升子序列问题.
案例:
6008 1300
6000 2100
50...
分类:
其他好文 时间:
2014-08-05 11:12:06
阅读次数:
295
~~~~
二维的最长上升子序列。n^2算法居然可以水过。。
就不多说了,排个序,然后DP。
题目链接:http://poj.org/problem?id=1609
~~~~
#include
#include
#include
#include
#define N 11111
using namespace std;
struct node
{
int l,m;
}b[N];
...
分类:
其他好文 时间:
2014-08-04 02:07:06
阅读次数:
232
~~~~
由题意可知,因为左边是按1~n的顺序递增排列,要想得到不相交组合,左边后面的一定与相应右边后面的相连,如此一来,
就可以发现其实是一道最长上升子序列的题目,要注意的是N
题目链接:http://poj.org/problem?id=1631
~~~~
nlogn的算法在这里补充一下。
最长不下降子序列的O(nlogn)算法分析如下:
设 A[t]表示序...
分类:
其他好文 时间:
2014-08-03 23:26:56
阅读次数:
364
~~~~
求最长不上升子序列,把数组倒过来不就是求最长上升子序列了么,QAQ..
用的是nlogn算法,不清楚的请戳:http://blog.csdn.net/darwin_/article/details/38360997
题目链接:http://poj.org/problem?id=1887
~~~~
#include
#include
#include
#include
#defi...
分类:
其他好文 时间:
2014-08-03 23:25:26
阅读次数:
309
题意:给你长为n的序列 ,每个节点都和在它前面且值比他大的点产生一条边,问你一个最大 两两点没有边的集合的 集合元素有多少解题思路:想了半天才发现是最长上升子序列。。解题代码: 1 // File Name: 340d.cpp 2 // Author: darkdream 3 // Created ...
分类:
其他好文 时间:
2014-08-03 17:45:05
阅读次数:
204
~~~~
两道题的意思差不多,HDU上是求最长上升子序列的和,而POJ上就的是其长度。
貌似还有用二分写的nlogn的算法,不过这俩题n^2就可以过嘛。。
~~~~
题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=1087
http://poj.org/problem?id=2533
~~~~
HDU1087:
#include...
分类:
其他好文 时间:
2014-08-02 23:30:15
阅读次数:
243
http://acm.hdu.edu.cn/showproblem.php?pid=3308题意: 两个操作 : 1 修改 单点 a 处的值。 2求出 区间【a,b】内的最长上升子序列。做法:线段树区间合并。了解线段树的具体含义很容易。1//bycaonima2//hehe3#include4#.....
分类:
其他好文 时间:
2014-08-01 22:30:42
阅读次数:
227
最长上升子序列、最长不下降子序列,解法差不多,就一点等于不等于的差别,我这里说最长不下降子序列的。有两种解法。一种是DP,很容易想到,就这样:1 REP(i,n)2 {3 f[i]=1;4 FOR(j,0,i-1)5 ...
分类:
其他好文 时间:
2014-08-01 18:49:52
阅读次数:
361