摘要: 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2586题意:给你N个点,M次询问。1~N-1行输入点与点之间的权值,之后M行输入两个点(a,b)之间的最近距离;思路:... 阅读全文
posted @ 2019-08-10 10:41 是妖妖灵鸭 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://poj.org/problem?id=3660 题意:有n头牛, 给你m对关系。(a, b)表示牛a能打败牛b, 求在给出的这些关系下, 能确定多少头牛的排名。 传递闭包: 关系之间具有传递性(例如a> b, b> c, 那么a> c), 在那些已给出的关系基础上, 通过传递性 阅读全文
posted @ 2019-08-09 23:04 是妖妖灵鸭 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2544思路:最短路的模板题Dijkstra 算法是一种类似于贪心的算法,步骤如下:1、当到一个点时,图上部分的点的最短... 阅读全文
posted @ 2019-08-07 22:52 是妖妖灵鸭 阅读(82) 评论(0) 推荐(0) 编辑
摘要: Description Building and maintaining roads among communities in the far North is an expensive business. With this in mind, the roads are build such th 阅读全文
posted @ 2019-08-07 22:37 是妖妖灵鸭 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://poj.org/problem?id=3585题意:给定一张无根图,给定每条边的容量,随便取一点使得从这个点出发作为源点,发出的流量最大,并且输出这个最大的流量。 思路:最近开始做树形DP这... 阅读全文
posted @ 2019-08-06 21:30 是妖妖灵鸭 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 邻接表的学习之前我们介绍过图的邻接矩阵存储法,它的空间和时间复杂度都是N2,现在我来介绍另外一种存储图的方法:邻接表,这样空间和时间复杂度就都... 阅读全文
posted @ 2019-08-06 13:42 是妖妖灵鸭 阅读(317) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://poj.org/problem?id=2796题意:给你一串数字,需要你求出(某个子区间乘以这段区间中的最小值)所得到的最大值例子:63 1 6 4 5 2 当L=3,R=5时这段区间总和为... 阅读全文
posted @ 2019-08-04 22:59 是妖妖灵鸭 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 传送门:https://ac.nowcoder.com/acm/contest/885/B题意:给出,由公式 求出思路:没学过矩阵快速幂。题解说是矩阵快速幂,之后就学了一遍。(可以先去学一下矩阵快速幂)构造。然后... 阅读全文
posted @ 2019-08-03 22:32 是妖妖灵鸭 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://poj.org/problem?id=1952题意:给你n个数,计算最长下降子序列的个数(并且不能重复)例如 5 3 5 3 该序列中 最长下降子序列的个数只有一个思路:长度的话用进行转移... 阅读全文
posted @ 2019-07-29 21:14 是妖妖灵鸭 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 传送门:https://www.luogu.org/problem/P3808题解:是一个AC自动机的裸题了,注释加在代码里面了#includeusing namespace std;const int maxn... 阅读全文
posted @ 2019-07-28 23:21 是妖妖灵鸭 阅读(94) 评论(0) 推荐(0) 编辑