随笔分类 - 图论
摘要:坑点在于:绝对大于的第k短路 板子题 代码:
阅读全文
摘要:坑点在于:绝对大于的第k短路 板子题 代码:
阅读全文
摘要:https://vjudge.net/problem/POJ-3041 Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <=
阅读全文
摘要:好麻烦啊! 存下来当模板吧,,不想写 http://www.cnblogs.com/zhujiangning/p/7157465.html
阅读全文
摘要:http://hdu.hustoj.com/showproblem.php?pid=2063 RPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各
阅读全文
摘要:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=820&pid=1006 度度熊有一张 nnn 个点 mmm 条边的无向图,所有点按照 1,2,⋯,n1,2,\cdots,n1,2,⋯,n 标号,每条边有一个正整数权值
阅读全文
摘要:https://www.luogu.org/problemnew/show/P2057 幼儿园里有n个小朋友打算通过投票来决定睡不睡午觉。对他们来说,这个问题并不是很重要,于是他们决定发扬谦让精神。虽然每个人都有自己的主见,但是为了照顾一下自己朋友的想法,他们也可以投和自己本来意愿相反的票。我们定义
阅读全文
摘要:这个博客很全:https://blog.csdn.net/x_y_q_/article/details/51999466 EK(Edmond—Karp)算法 Ford-Fulkerson算法 Dinic算法(前两种的优化) 网络中有两台计算机s和t ,现在想从s传输数据到t 该网络中一共有n太计算机
阅读全文
摘要:题目:给定一个n个顶点组成的带权有向图的距离矩阵d(i,j)(INF 表示没有边)。要求从顶点0出发,再回到顶点0 问所经过的边权重的最小值是多少 5 80 1 30 3 41 2 52 0 42 3 53 4 34 1 64 0 7 12 数据范围很大,所以用了dijkstr的优化版 代码:
阅读全文
摘要:来一道裸代码。输入:一个图有向图。输出:它每个强连通分量。 这个图就是刚才讲的那个图。一模一样。 input: 6 8 1 3 1 2 2 4 3 4 3 5 4 6 4 1 5 6 output: 6 5 3 4 2 1 代码: 还有各大理解网站: (杂着看,就可以看懂) http://blog.
阅读全文
摘要:题目:https://vjudge.net/problem/POJ-2186 Every cow's dream is to become the most popular cow in the herd. In a herd of N (1 <= N <= 10,000) cows, you ar
阅读全文
摘要:题目:https://vjudge.net/problem/POJ-3268 One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to
阅读全文
摘要:题目:https://vjudge.net/problem/POJ-3259 While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very pe
阅读全文
摘要:题目:http://hdu.hustoj.com/showproblem.php?pid=5876 In graph theory, the complement of a graph G is a graph H on the same vertices such that two distinc
阅读全文
摘要:https://vjudge.net/contest/215355#problem/A A robot has been programmed to follow the instructions in its path. Instructions for the next direction th
阅读全文
摘要:题目: 链接:https://www.nowcoder.com/acm/contest/76/D来源:牛客网 题目描述 这个挖矿游戏会给出一个n*m个格子的地图,每个格子都有黄金。在游戏开始时小明会随机出现在地图的某一个格子当中。小明可以将他所在的格子的黄金收归囊中,并且还可以向下或者向右移动,然后
阅读全文
摘要:题目: 链接:https://www.nowcoder.com/acm/contest/76/F来源:牛客网 从实验室出来后,你忽然发现你居然把自己的电脑落在了实验室里,但是实验室的老师已经把大门锁上了。更糟的是,你没有那个老师的电话号码。你开始给你知道的所有人打电话,询问他们有没有老师的电话,如果
阅读全文
摘要:题目: https://www.nowcoder.com/acm/contest/76/B 链接:https://www.nowcoder.com/acm/contest/76/B来源:牛客网 随着如今社会的不断变化,交通问题也变得越来越重要,所以市长决定建设一些公路来方便各个城市之间的贸易和交易。
阅读全文
摘要:题目:https://vjudge.net/problem/POJ-1125 Stockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disin
阅读全文