
---------图论---------
deerly_
懒了这么久,我也该勤快一些了
展开
-
J - 迷宫问题 POJ - 3984 (记录走过的路径)
这个题是一个很简单的bfs,但是与之前的不同是它需要记录路径,哈哈哈哈哈哈哈哈想了一下午终于会记录了好开心~ Problem Description 给你一个5*5的二维数组,表示一个迷宫,0可以走,1不可以走,问你从左上角到右下角,最短的路径,保证数据有唯一的解。#include <cstdio>#include <queue>#include <cstring>using names原创 2017-05-22 21:15:01 · 325 阅读 · 0 评论 -
Island Transport HDU 4280 Dinic模板
Island Transport HDU 4280 Dinic模板题目链接:https://cn.vjudge.net/contest/163017#problem/G 题目大意:给出N个点的坐标和M条有容量的边,找出从最西边的点到最东边的点的最大流量。 题目分析:抄的李东庆的模板,于是以后就打算用这个板子搞 Dinic 了。 题目分析:略。#include &lt;bits/s...原创 2018-05-11 22:11:21 · 164 阅读 · 0 评论 -
最短路 模板总结
前向星 + Dijkstra#include <cstdio>#include <queue>#include <iostream>#include <cstring>using namespace std;const int maxn = 1e5 + 10;const int inf = 0x3f3f3f3f;struc...原创 2018-05-24 20:02:54 · 133 阅读 · 0 评论 -
最小生成树
Prim#include &lt;cstdio&gt;#include &lt;iostream&gt;#include &lt;cstring&gt;using namespace std;const int maxn = 112;const int inf = 0x3f3f3f3f;int data[maxn][maxn], n, m, dist[maxn];bool ...原创 2018-05-24 20:12:03 · 396 阅读 · 0 评论 -
F - Alyona and the Tree CodeForces - 682C DFS
Alyona and the Tree CodeForces - 682C DFS题目大意:有一棵树,节点有权值,边也有权值,问满足dist(v, u) >a[u]的节点有多少个,dist(v, u)是说u,v两个节点之间的距离,a[u]是说这个节点的权值。需要注意的事情是这棵树有根1。 题目分析:一开始的时候,有个疑问是对于一棵子树,如果它的根去掉了,那么他的子树是往上接还是直接去掉...原创 2018-07-08 10:39:51 · 213 阅读 · 0 评论