网络流
薄层
努力就有收获~
展开
-
uva-1349 Optimal Bus Route Design(最小费用最大流)
A big city wants to improve its bus transportation system. One of the improvement is to add scenicroutes which go es through attractive places. Your task is to construct a bus-route-plan for sight-seeingbuses in a city.You are given a set of scenic loca原创 2017-10-24 19:40:48 · 357 阅读 · 0 评论 -
POJ-1637 Sightseeing tour(通过网络流判定混合图的欧拉回路)
The city executive board in Lund wants to construct a sightseeing tour by bus in Lund, so that tourists can see every corner of the beautiful city. They want to construct the tour so that every street in the city is visited exactly once. The bus should als原创 2017-08-02 19:31:34 · 399 阅读 · 0 评论 -
POJ-2135 Farm Tour(费用流)
When FJ's friends visit him on the farm, he likes to show them around. His farm comprises N (1 <= N <= 1000) fields numbered 1..N, the first of which contains his house and the Nth of which contains the big barn. A total M (1 <= M <= 10000) paths that conn原创 2017-07-24 14:12:58 · 264 阅读 · 0 评论 -
POJ-1149 PIGS(最大流)
Mirko works on a pig farm that consists of M locked pig-houses and Mirko can't unlock any pighouse because he doesn't have the keys. Customers come to the farm one after another. Each of them has keys to some pig-houses and wants to buy a certain number of原创 2017-07-22 14:16:24 · 297 阅读 · 0 评论 -
hihoCoder 最大权闭合子图
在一个图中,我们选取一些点构成集合,记为V,且集合中的出边(即集合中的点的向外连出的弧),所指向的终点(弧头)也在V中,则我们称V为闭合图。最大权闭合图即在所有闭合图中,集合中的点的权值之和最大的V,我们称V为最大权闭合图。(可抽象为最大权密闭图求法的题一般是含有一些点具有一定的利益收入,另一些点具有一定的利益支出,即每个点都有一个权值。拥有某个具有收入效益的点前提是必须得拥有一些具有一定利益原创 2017-07-18 19:29:22 · 791 阅读 · 0 评论 -
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 in their new films. Unfortunately, all these companies will start making the films at t原创 2017-07-19 18:42:15 · 310 阅读 · 0 评论 -
网络流之费用流
求费用流目前好像只有EK+SPFA改版,时间复杂度为O(N*E*k),其中K为最大流值。但时间上的期望时间复杂度为:O(A*E*K),其中A为所有顶点进队列的平均次数,可以证明A一般小于等于2。最小费用最大流:#include using namespace std;const int inf = 0x3f3f3f3f;const int maxn = 205;struct原创 2017-06-06 12:57:39 · 3217 阅读 · 0 评论 -
网络流-割的概念以及定理
1. 网络流的割:是网络中顶点的一个划分,把所有顶点划分成两个顶点集合S和T,其中源点s属于S,汇点t属于T,记作CUT(S,T)。2. 割的割边:如果一条弧的两个顶点一个属于顶点集S一个属于顶点集T,该弧为割CUT(S,T)的一条割边。3. 从S指向T的割边是正向割边; 从T指向S的割边是逆向割边。4. 割的容量:所有正向割边的容量和,不同割的容量不同。5.原创 2017-06-03 00:34:15 · 5636 阅读 · 0 评论 -
网络流之最大流(FF, EK, Dinic, SAP)
对于Gap优化成立的解释:假如某次修改d[u]后第一次出现断层k,显然d[u]之前是等于k的,而d[u]修改的原因是修改前d[u] < d[v]+1,所以d[v] > k-1,而因为出现断层k,d[v] != k,故d[v] 〉 k。而由于d函数时单调递增的,所以这个空缺永远不会被填补。而你可能会想会不会存在存在若干个层次k-1的点和层次k+1的点能填补这个空缺?答案是否定的,因为假如存在层次k-1的点和层次k+1的点连边,那么层次k+1的这个点的存在是不合适的,因为不管是初始时候或者是之后修改层次的原因原创 2017-05-31 23:50:31 · 4469 阅读 · 1 评论 -
2017 百度之星B轮初赛(Chess, 度度熊的交易计划, 小小粉丝度度熊)
HDU 6114 HDU 6115 HDU 6116 HDU 6117 HDU 6118 HDU 6119ChessAccepts: 1805Submissions: 573Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Problem Description車是中国象棋中的一种棋子,它能攻击同一行或同一列中没有其原创 2017-08-13 23:07:24 · 542 阅读 · 0 评论 -
HDU 2448 Mining Station on the Sea(最小费用最大流, KM算法)
The ocean is a treasure house of resources and the development of human society comes to depend more and more on it. In order to develop and utilize marine resources, it is necessary to build mining stations on the sea. However, due to seabed mineral resou原创 2017-08-14 22:59:26 · 410 阅读 · 0 评论 -
codeforces-510E Fox And Dinner(带限制的二分图多重匹配+奇偶建图+打印路径)
Fox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old.They will have dinner around some round tables. You want to distribute foxes such that:Each fox is sitting at some table.Each原创 2017-10-13 16:35:28 · 305 阅读 · 0 评论 -
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 the planet. Now scientists want your help, is to determine what all of people can liv原创 2017-10-04 20:07:35 · 339 阅读 · 0 评论 -
hihocoder-1393 二分图的多重匹配(网络流做法)
学校的秋季运动会即将开始,为了决定参赛人员,各个班又开始忙碌起来。小Hi和小Ho作为班上的班干部,统计分配比赛选手的重任也自然交到了他们手上。已知小Hi和小Ho所在的班级一共有N名学生(包含小Hi和小Ho),编号依次为1..N。运动会一共有M项不同的比赛,编号为1..M。第i项比赛每个班需要派出m[i]名选手参加。根据小Hi和小Ho的统计,编号为i的学生表示最多同时参加a[i]项比赛,并且给出他所擅长的b[i]项比赛的编号。小Hi和小Ho希望将每个学生都安排到他所擅长的比赛项目,以增加夺冠的可能性原创 2017-10-02 21:15:13 · 404 阅读 · 0 评论 -
HDU-3416 Marriage Match IV(最短路+最大流)
Do not sincere non-interference。 Like that show, now starvae also take part in a show, but it take place between city A and B. Starvae is in city A and girls are in city B. Every time starvae can get to city B and make a data with a girl he likes. But the原创 2017-09-25 12:55:23 · 275 阅读 · 0 评论 -
计蒜客-2017 ACM-ICPC 亚洲区(西安赛区)网络赛E题Maximum Flow(网络流打表找规律)
2017 ACM-ICPC 亚洲区(西安赛区)网络赛Given a directed graph with nn nodes, labeled 0,1, \cdots, n-10,1,⋯,n−1.For each <i, j><i,j> satisfies 0 \le i < j < n0≤i<j<n, there exists an edge from the i-th node to the j-th node, the capacity of which is ii xor jj.Find th原创 2017-09-19 12:58:31 · 741 阅读 · 0 评论 -
HDU-5889 Barricade(最小割或最短路+最小割)
2016 ACM/ICPC Asia Regional Qingdao OnlineThe empire is under attack again. The general of empire is planning to defend his castle. The land can be seen as NN towns and MM roads, and each road has the same length and connects two towns. The town numbered原创 2017-09-16 23:33:35 · 282 阅读 · 0 评论 -
HDU-5855 Less Time, More profit(最大权闭合图+二分)
The city planners plan to build N plants in the city which has M shops. Each shop needs products from some plants to make profit of proiproi units. Building ith plant needs investment of payipayi units and it takes titi days. Two or more plants can be b原创 2017-09-14 10:22:44 · 254 阅读 · 0 评论 -
计蒜客-2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛J题Our Journey of Dalian Ends (最小费用最大流)
题意:给定若干个城市,出发点为大连,目的地为西安,但是要求中途必须经过上海,并且图中每个城市只能经过一次,给出m条路(双向道路),走第i条路需要wi代价,求所有满足要求的方案中花费的最小代价,如果没有满足的方案,输出-1。思路:相当于求从大连到上海加上西安到上海花费的代价总和最小。所以就是最小费用流,点只可走一次,所以进行拆点,一个入点一个出点,每条路连接至相应的出点到入点,容量为1,原创 2017-09-09 21:36:04 · 1070 阅读 · 0 评论 -
HDU-6214 Smallest Minimum Cut(最小割)
2017 ACM/ICPC Asia Regional Qingdao OnlineConsider a network $G=(V,E)$ with source $s$ and sink $t$. An s-t cut is a partition of nodes set $V$ into two parts such that $s$ and $t$ belong to different parts. The cut set is the subset of $E$ with all edges原创 2017-09-18 13:24:32 · 685 阅读 · 5 评论