- 博客(54)
- 收藏
- 关注
转载 树状dp的闲扯....
树,一种十分优美的数据结构,因为它本身就具有的递归性,所以它和子树见能相互传递很多信息,还因为它作为被限制的图在上面可进行的操作更多,所以各种用于不同地方的树都出现了,二叉树、三叉树、静态搜索树、AVL树,线段树、SPLAY树,后缀树等等.. 枚举那么多种数据结构只是想说树方面的内容相当多,本专辑只针对在树上的动态规划,即树形DP.做树形DP一般步骤是先将树转换为有根树,然后在树上
2014-10-03 15:34:53 574
原创 zoj 3810 A Volcanic Island
四色原理模板题....A Volcanic IslandTime Limit: 2 Seconds Memory Limit: 65536 KB Special JudgeAn underwater volcano has erupted massively in somewhere of the deep Atlantis Ocean. This
2014-09-29 00:39:15 444
原创 状压dp
动态规划本来就很抽象,状态的设定和状态的转移都不好把握,而状态压缩的动态规划解决的就是那种状态很多,不容易用一般的方法表示的动态规划问题,这个就更加的难于把握了。难点在于以下几个方面:状态怎么压缩?压缩后怎么表示?怎么转移?是否具有最优子结构?是否满足后效性?涉及到一些位运算的操作,虽然比较抽象,但本质还是动态规划。找准动态规划几个方面的问题,深刻理解动态规划的原理,开动脑筋思考问题。这才是掌握动
2014-09-27 17:11:15 757
原创 费用流!
DescriptionWhen FJ's friends visit him on the farm, he likes to show them around. His farm comprises N (1 <= N <= 1000) fields numbered 1..N, the first of which contains his house and the Nth of
2014-09-06 23:58:21 454
原创 网络流standard model
//Edmondes-Karp#include #include #include #define INF 0x7fffffffusing namespace std;queue q;const int maxn = 200;int n, m, ans;int next[maxn+10], p[maxn+10], f[maxn+10][maxn+10], cap[maxn+10]
2014-09-06 23:56:07 460
原创 hdu 4291
A Short problemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 344 Accepted Submission(s): 131Problem Description Acco
2014-09-05 21:33:19 501
转载 HDU 4288
Problem Description In mathematics and computer science, an algorithm describes a set of procedures or instructions that define a procedure. The term has become increasing popular since the adven
2014-09-05 21:30:22 382
原创 HDOJ 4293 dp
Description According to a research, VIM users tend to have shorter fingers, compared with Emacs users. Hence they prefer problems short, too. Here is a short one: Given n (1 18), You sho
2014-09-05 21:20:18 401
转载 HDU 4031 Attack(离线+线段树)
A - ATime Limit:3000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionToday is the 10th Annual of “September 11 attacks”, the Al Qaeda is about t
2014-09-03 21:34:48 2098
原创 LCM~~~!!!
D - LCATime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionA rooted tree is a well-known data structure in computer science and en
2014-08-23 21:12:24 416
转载 dp的开关路灯
An Easy GameTime Limit: 2 Seconds Memory Limit: 65536 KBOne day, Edward and Flandre play a game. Flandre will show two 01-strings s1 and s2, the lengths of two strings are n. Then, Edwa
2014-08-22 09:52:53 434
原创 multi-
G - GTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionDevu and his brother love each other a lot. As they are super geeks, they
2014-08-21 21:29:48 423
转载 prim算法
最小生成树prim算法实现今天从志权师兄那里学会了最小生成树。所谓生成树,就是n个点之间连成n-1条边的图形。而最小生成树,就是权值(两点间直线的值)之和的最小值。 首先,要用二维数组记录点和权值。如上图所示无向图:int map[7][7]; map[1][2]=map[2][1]=4; map[
2014-08-21 18:34:29 425
转载 凸包的模板
WallTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 17387 Accepted: 5627DescriptionOnce upon a time there was a greedy King who or
2014-08-21 17:26:05 428
原创 凸包 你敢更残暴吗?
在学习了一些有关计算机几何的基础知识和一些基本工具之后要快速的解决一些简单的几何问题,如两点之间的距离、两线段的交点个数等等是可以轻松应付的,但是对于复杂点的几何问题,我们还是要有更好的算法,这样才可以更高效的解决它。在这一篇中来总结 平面凸包 的 Graham算法;http://www.cnblogs.com/jbelial/平面凸包 : 定义: 对一个简单多边形
2014-08-21 17:19:01 560
原创 树状数组解决!~~~~
DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 We can change the matrix in the fol
2014-08-21 13:15:17 491
原创 优先队列~~~
E - 楼上哪里比楼上的楼上简单了?没看出来!但是我知道我最简单了!Time Limit:12000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionAn array of size n ≤ 10 6 is given to you.
2014-08-19 21:13:51 313
原创 计算几何的基本应用~~~~
A - TOYSTime Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionCalculate the number of toys that land in each bin of a partitioned to
2014-08-18 17:19:39 471
原创 计算几何的模板
其实还是万能的模板!!!!万岁~#include#include#includeusing namespace std;const double eps=1e-8;struct point{ double x,y; point(double x=0,double y=0):x(x),y(y) {};};int dcmp(double x){ if(fab
2014-08-18 14:50:52 360
原创 QAQ map 用法
暑假归来第一弹——————————————————————————————————————————————————————————————————————————————
2014-08-18 10:21:13 383
原创 优化下的来去问题
C - 模板Time Limit:8000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionIn the age of television, not many people attend theater performances.
2014-07-30 22:04:49 439
原创 spfa的最小生成树~
#include#include#include#include#include#includeusing namespace std;#define N 210#define d double#define INF 0xffffffint n;int visit[N];d dis[N],len[N][N];d a,b,c;struct node{ d x,y;
2014-07-30 19:49:00 390
原创 图论~~!!!
A - 模板Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionBessie is out in the field and wants to get back to the barn to get as m
2014-07-30 16:08:16 371
原创 倒序的拓扑排序
#include#include#includeusing namespace std;int chudu[209];int deg[209][209];int wei[209];int main(){int cases;scanf("%d",&cases);while(cases--){int n,m;scanf("%d%d",&n,&m)
2014-07-29 12:25:28 508
原创 拓扑排序
A - Sorting It All OutTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionAn ascending sorted sequence of distinct values is one i
2014-07-28 20:39:57 375
转载 重载运算符的使用~~~
额 表示我对重载运算真的不熟啊....在前一节中曾提到过,C++中运行时的多态性主要是通过虚函数来实现的,而编译时的多态性是由函数重载和运算符重载来实现的。这一系列我将主要讲解C++中有关运算符重载方面的内容。在每一个系列讲解之前,都会有它的一些基础知识需要我们去理解。而运算符重载的基础就是运算符重载函数。所以今天主要讲的是运算符重载函数。 1.运算符重载是对已有的
2014-07-28 11:50:15 857
原创 矩阵的连乘
B - 矩阵快速幂Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionJzzhu has invented a kind of sequences, they meet the following property
2014-07-28 11:30:27 414
原创 利用lazy显示树~(注意lazy的更新)
A - lazy标记Time Limit:5000MS Memory Limit:131072KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionYou have N integers, A1, A2, ... , AN. You need to deal with two ki
2014-07-26 21:42:24 392
原创 线段树 基础
D - 基础Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和
2014-07-26 13:47:07 383
转载 真跪了~!!!!!!! 并查集
题目就不在这里贴出了。这题目我不会,虽然知道是一道并查集的题目。上网搜答案,乱看一气,有以下几点体会:依然是并查集的find-union框架。除父子关系信息(最基本的并查集)之外,还附加了“与根结点谁吃谁(或者同类)”的信息。find函数中,与以往靠while循环寻找始祖不同,这次是递归调用find函数寻找始祖—这导致了路径压缩的根本性改变:沿途的所有结点都直接指向始祖了!规定
2014-07-24 20:49:05 431
原创 线段树
A - 基础Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionAstronomers often examine star maps where stars are represented by points
2014-07-24 16:14:23 323
原创 花瓶的线性dp
F - 简单dpTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionYou want to arrange the window of your flower shop in a most pleasant
2014-07-22 19:39:42 388
原创 记录路径的背包问题
H - 多重背包记录方案Time Limit:1000MS Memory Limit:30000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionCharlie is a driver of Advanced Cargo Movement, Ltd. Charlie drives
2014-07-21 21:24:03 1128
原创 完全背包
G - 完全背包Time Limit:1000MS Memory Limit:30000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionJohn never knew he had a grand-uncle, until he received the notary's l
2014-07-21 15:11:20 350
原创 分组背包
D - 分组背包 基础Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionACboy has N courses this term, and he plans to spend at most M days o
2014-07-21 12:13:21 410
原创 完全背包
A - 完全背包 基础Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionBefore ACM can do anything, a budget must be prepared and the necessa
2014-07-19 17:15:30 338
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人