
图论java实现
coldfresh
那我们开始吧
展开
-
倍增LCA
There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this “How far is it if I want to go from house A to house B”? Usually it hard to...原创 2018-05-15 19:33:07 · 394 阅读 · 0 评论 -
有向图的强连通分量
HDU - 2767(强连通分量) 求一个有向图里加最少的边使得任意两点可达。。import java.util.ArrayList;import java.util.Arrays;import java.util.LinkedList;import java.util.Queue;import java.util.Scanner;public class Main{ ...原创 2018-05-17 19:04:51 · 528 阅读 · 0 评论 -
无向图的桥
没有具体例图,就是直接找出,那些边是桥。import java.util.Arrays;import java.util.Scanner;public class Main{ static int SIZE=100010; static int head[]=new int[SIZE],to[]=new int[SIZE<<1],next[]=ne...原创 2018-05-17 19:07:51 · 1284 阅读 · 0 评论 -
无向图的边双连通分量(FROM Redundant Paths POJ - 3177 )
In order to get from one of the F (1 <= F <= 5,000) grazing fields (which are numbered 1..F) to another field, Bessie and the rest of the herd are forced to cross near the Tree of Rotten Apples....原创 2018-05-17 19:51:23 · 363 阅读 · 0 评论 -
最大流(dinic算法)
题目来源Drainage Ditches HDU - 1532 ,裸的最大流 代码: 选用dinic有如下优势 1.代码量小,容易记忆。 2.效率上比EK算法快很多,虽然比asp稍慢,但是是可以接受的。import java.util.Arrays;import java.util.Scanner;public class Main{ final static...原创 2018-05-24 21:03:37 · 1325 阅读 · 0 评论 -
二分图最大匹配
来自裸题:过山车 HDU - 2063 代码:import java.util.Arrays;import java.util.Scanner;public class Main{ final static int maxn=1005; final static int maxx=2005; final static int INF =0x3f3f3...原创 2018-05-24 21:04:35 · 219 阅读 · 0 评论