![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图论
长歌丶采薇
这个作者很懒,什么都没留下…
展开
-
HDU - 5988 Coding Contest(最小费用流)
HDU - 5988 Coding Contest(最小费用流)A coding contest will be held in this university, in a huge playground. The whole playground would be divided into N blocks, and there would be M directed paths linkin...原创 2019-10-13 22:16:43 · 122 阅读 · 0 评论 -
HYSBZ - 1001 狼抓兔子 (网络流板子)
HYSBZ - 1001 狼抓兔子 (网络流板子)现在小朋友们最喜欢的"喜羊羊与灰太狼",话说灰太狼抓羊不到,但抓兔子还是比较在行的,而且现在的兔子还比较笨,它们只有两个窝,现在你做为狼王,面对下面这样一个网格的地形:左上角点为(1,1),右下角点为(N,M)(上图中N=4,M=5).有以下三种类型的道路1:(x,y)<>(x+1,y)2:(x,y)<>(x,y...原创 2019-07-21 21:53:53 · 161 阅读 · 0 评论 -
POJ 2516 Minimum Cost(最小费用最大流)
POJ 2516 Minimum Cost(最小费用最大流)Dearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 to N) which stocks goods from him...原创 2019-07-27 19:31:57 · 215 阅读 · 0 评论 -
meeting 牛客暑假多校训练第四场A
题目链接:https://ac.nowcoder.com/acm/contest/884/A题目大意在一个有n点的树上,有k个人,要从树上选一个点,这k个人都要到这个点来开会。树的边权都为1.问:最少需要多长时间大家能都到一个点来开会(大家是同时出发的)解题思路:这个很像树的直径,随便选一个人,找离这个人最远的一个人x,然后再从x这个人开始找,找一个最远的人y,则x—>y就是最长...原创 2019-07-27 18:25:05 · 92 阅读 · 0 评论 -
free牛客暑假多校训练第四场 J(分层图求最短路板子)
题目链接:https://ac.nowcoder.com/acm/contest/884/J题目大意:给你一个n个点m条边的图。允许一开始条边让其边权变为0,问最短路长度。解题思路:分层图求最短路板子AC代码:#include <bits/stdc++.h>#define ll long longusing namespace std;const int maxn ...原创 2019-07-27 18:29:53 · 110 阅读 · 0 评论 -
HDU-2732 Leapin' Lizards(网络流)
HDU-2732 Leapin’ Lizards(网络流)Your platoon of wandering lizards has entered a strange room in the labyrinth you are exploring. As you are looking around for hidden treasures, one of the rookies steps ...原创 2019-07-28 11:44:31 · 126 阅读 · 0 评论 -
UVA - 10480 Sabotage (网络流之最小割 + 输出最小割的边)
UVA - 10480 Sabotage (最小割 + 输出最小割的边)The regime of a small but wealthy dictatorship has been abruptly overthrown by an unexpected rebellion. Because of the enormous disturbances this is causing in wor...原创 2019-08-01 21:32:03 · 155 阅读 · 0 评论 -
POJ - 1459 Power Network(网络流)
POJ - 1459 Power Network(网络流)A power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be supplied with an amount s(u) >= 0 of ...原创 2019-08-01 22:05:48 · 121 阅读 · 0 评论 -
洛谷 P3388 【模板】割点 (targan求割点模板)
洛谷 P3388 【模板】割点 (targan求割点模板)题目描述给出一个nn个点,mm条边的无向图,求图的割点。输入格式第一行输入n,mn,m下面mm行每行输入x,yx,y表示xx到yy有一条边输出格式第一行输出割点个数第二行按照节点编号从小到大输出节点,用空格隔开输入输出样例输入 #1 复制6 71 21 31 42 53 54 55 6输出 #1 复制...原创 2019-08-13 14:00:43 · 208 阅读 · 0 评论 -
洛谷 P2921 在农场万圣节Trick or Treat on the Farm (tarjan求强连通分量)
洛谷 P2921 在农场万圣节Trick or Treat on the Farm (targan求强连通分量)题目描述每年,在威斯康星州,奶牛们都会穿上衣服,收集农夫约翰在N(1<=N<=100,000)个牛棚隔间中留下的糖果,以此来庆祝美国秋天的万圣节。由于牛棚不太大,FJ通过指定奶牛必须遵循的穿越路线来确保奶牛的乐趣。为了实现这个让奶牛在牛棚里来回穿梭的方案,FJ在第i号隔...原创 2019-08-13 14:12:24 · 196 阅读 · 0 评论 -
POJ - 1236 - Network of Schools (targan求强联通分量缩点)
POJ - 1236 - Network of Schools (targan求强联通分量缩点)A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to...原创 2019-08-13 17:55:17 · 146 阅读 · 0 评论 -
HDU - 4738 Caocao's Bridges(targan 求桥(割边) +判重边)
HDU - 4738 Caocao’s Bridges(targan 求桥 +判重边)Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi. But he wouldn’t give up. Caocao’s army still was not good at water battles, so he cam...原创 2019-08-14 10:36:09 · 195 阅读 · 0 评论 -
HDU - 4635 Strongly connected(targan 求差一强联通分量)
HDU - 4635 Strongly connected(targan 差一强联通分量)Give a simple directed graph with N nodes and M edges. Please tell me the maximum number of the edges you can add that the graph is still a simple direct...原创 2019-08-14 10:54:58 · 137 阅读 · 0 评论 -
HDU-6705 path(2019CCPC网络赛1004) Kth路径 思维+套路题
HDU-6705 path(2019 CCPC网络赛1004)You have a directed weighted graph with n vertexes and m edges. The value of a path is the sum of the weight of the edges you passed. Note that you can pass any edge an...原创 2019-08-24 18:48:42 · 259 阅读 · 0 评论 -
HDU - 5934 Bomb(tarjan缩点)
HDU-5934 Bomb(tarjan缩点)There are N bombs needing exploding.Each bomb has three attributes: exploding radius ri, position (xi,yi) and lighting-cost ci which means you need to pay ci cost making it e...原创 2019-09-18 19:15:05 · 170 阅读 · 0 评论 -
网络流——Dinic模板
#include <iostream>#include <cstdio>#include <cstring>#include <queue>#include <algorithm>#define inf 0x3f3f3f3fusing namespace std;const int maxn = 1e5+10;int n,...原创 2019-07-21 21:50:34 · 93 阅读 · 0 评论 -
HDU - 3081 Marriage Match II (网络流 +二分 )
HDU - 3081 Marriage Match II (网络流 +二分 )Presumably, you all have known the question of stable marriage match. A girl will choose a boy; it is similar as the game of playing house we used to play when...原创 2019-08-02 15:35:15 · 150 阅读 · 0 评论 -
HDU Problem- 4289 Control (网络流_最小割)
HDU Problem- 4289 Control (网络流_最小割)You, the head of Department of Security, recently received a top-secret information that a group of terrorists is planning to transport some WMD 1 from one city (th...原创 2019-07-24 21:42:19 · 113 阅读 · 0 评论 -
HDU - 1281(二分图--匈牙利算法)
HDU - 1281(二分图–匈牙利算法)小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽量多的一些国际象棋里面的“车”,并且使得他们不能互相攻击,这当然很简单,但是Gardon限制了只有某些格子才可以放,小希还是很轻松的解决了这个问题(见下图)注意不能放车的地方不影响车的互相攻击。所以现在Gardon想让小希来解决一个更难的问题,在保证尽量多的“车”的前提下,棋盘里有些格子...原创 2018-11-05 20:10:05 · 240 阅读 · 0 评论 -
hdu -1520-Anniversary party (树形DP)
hdu -1520-Almost Arithmetical Progression(树形DP)There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. ...原创 2018-11-10 00:45:54 · 143 阅读 · 0 评论 -
HDU -3549 (最大网络流——Edmonds_Karp算法+Dinic算法)
HDU -3549 (最大网络流)Problem DescriptionNetwork flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for the weighted directed graph.InputThe fir...原创 2018-11-23 00:03:27 · 315 阅读 · 0 评论 -
HDU - 5943(Kingdom of Obsession)二分图+数学
HDU - 5943(Kingdom of Obsession)二分图+数学There is a kindom of obsession, so people in this kingdom do things very strictly.They name themselves in integer, and there are n people with their id continuo...原创 2019-03-27 19:27:05 · 204 阅读 · 0 评论 -
2019第16届浙江省赛——J - Welcome Party (并查集 + 建图)
Welcome Party (并查集 + 建图)The 44th World Finals of the International Collegiate Programming Contest (ICPC 2020) will be held in Moscow, Russia. To celebrate this annual event for the best competitive p...原创 2019-04-29 22:12:55 · 448 阅读 · 0 评论 -
UVA - 11419 (二分图匹配 ----最小点覆盖+ 输出覆盖的点)
UVA - 11419 (二分图匹配 ----最小点覆盖+ 输出覆盖的点)The world is in great danger!! Mental’s forces have returned toEarth to eradicate humankind. Our last hope to stop this greatevil is Sam “Serious” Stone. Equipp...原创 2019-05-08 22:51:20 · 579 阅读 · 0 评论 -
UVALive - 3415 (最大点独立集----最大二分匹配)
UVALive - 3415 (最大点独立集----最大二分匹配)Frank N. Stein is a very conservative high-school teacher. He wants to take some of his students on anexcursion, but he is afraid that some of them might become coup...原创 2019-05-09 14:06:11 · 121 阅读 · 0 评论 -
POJ 2387(最短路问题——Floyd Dijkstra SPFA算法)
POJ 2387-Til the Cows Come HomeBessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her bea...原创 2018-10-27 19:08:05 · 826 阅读 · 0 评论 -
HDU - 5452 Minimum Cut (树上差分)
HDU - 5452 Minimum Cut (树上差分)Given a simple unweighted graph G (an undirected graph containing no loops nor multiple edges) with n nodes and m edges. Let T be a spanning tree of G.We say that a cut...原创 2019-07-08 16:00:54 · 214 阅读 · 0 评论 -
最小费用流模板
最小费用流模板最大费用最小流只要在添加边的时候换一下位置就好了求最大费用最大流只需要把费用换成相反数,用最小费用最大流求解即可代码:#include <iostream>#include <queue>#include <cstdio>#include <cstring>#include <cmath>using n...原创 2019-07-24 11:26:51 · 138 阅读 · 0 评论 -
POJ 2195 & HDU 1533 Going Home(最小费用最大流)
POJ 2195 & HDU 1533 Going Home(最小费用最大流)On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adj...原创 2019-07-24 11:49:30 · 131 阅读 · 0 评论 -
POJ-1698 Alice's Chance (网络流)
POJ-1698 Alice’s Chance (网络流)Alice, a charming girl, have been dreaming of being a movie star for long. Her chances will come now, for several filmmaking companies invite her to play the chief role i...原创 2019-07-29 16:53:27 · 124 阅读 · 0 评论 -
HDU - 5889 Barricade(最短路上跑网络流)
HDU - 5889 Barricade(最短路上跑网络流)The empire is under attack again. The general of empire is planning to defend his castle. The land can be seen as N towns and M roads, and each road has the same length...原创 2019-07-24 17:37:28 · 112 阅读 · 0 评论 -
HDU-3605 Escape (网络流 + 状态压缩)
HDU-3605 Escape (网络流 + 状态压缩)2012 If this is the end of the world how to do? I do not know how. But now scientists have found that some stars, who can live, but some people do not fit to live some of ...原创 2019-07-24 20:03:04 · 130 阅读 · 0 评论 -
POJ - 1463-Strategic game(最小点覆盖)
POJ - 1463-Strategic game(最小点覆盖)Bob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he is very sad. Now he has the following ...原创 2018-11-14 19:03:44 · 148 阅读 · 0 评论