Drainage Ditches Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 45 Accepted Submission(s): 38   Problem Description Every time it rains on Farmer John's fields, a pond forms over Bessie's favorit…
妖怪题目,做到现在:2017/8/19 - 1:41…… 不过想想还是值得的,至少邻接矩阵型的Dinic算法模板get√ 题目链接:http://poj.org/problem?id=1815 Time Limit: 2000MS Memory Limit: 20000K Description In modern society, each person has his own friends. Since all the people are very busy, they communic…
POJ 1273给出M条边,N个点,求源点1到汇点N的最大流量. 本文主要就是附上dinic的模板,供以后参考. #include <iostream> #include <stdio.h> #include <algorithm> #include <queue> #include <string.h> /* POJ 1273 dinic算法模板 边是有向的,而且存在重边,且这里重边不是取MAX,而是累加和 */ using namespace…
#include<stdio.h> #include<queue> #include<string.h> using namespace std; #define inf 0x3fffffff #define N 200 struct node { int v,w,next; }bian[N*N*2],fbian[N*N*2]; int head[N],yong,tt; int deep[N];//深度保留层次图 void addedge(int u,int v,int…
最大流EK和Dinic算法 EK算法 最朴素的求最大流的算法. 做法:不停的寻找增广路,直到找不到为止 代码如下: @Frosero #include <cstdio> #include <iostream> #include <cstring> #include <queue> #define INF 0x3f3f3f3f using namespace std; int n,m; int cap[202][202],flow[202][202],mf[2…
Dual Core CPU Time Limit: 15000MS   Memory Limit: 131072K Total Submissions: 24830   Accepted: 10756 Case Time Limit: 5000MS Description As more and more computers are equipped with dual core CPU, SetagLilb, the Chief Technology Officer of TinySoft C…
题目链接:http://poj.org/problem?id=1273 Time Limit: 1000MS Memory Limit: 10000K Description Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3549 题目大意: 给有向图,求1-n的最大流 解题思路: 直接套模板,注意有重边 传送门:网络流入门 #include<iostream> #include<vector> #include<cstring> #include<cstdio> #include<queue> using namespace std; const int INF =…
//最短增广路,Dinic算法 struct Edge { int from,to,cap,flow; };//弧度 void AddEdge(int from,int to,int cap) //增弧 { edges.push_back((Edge){}); edges.push_back((Edge){to,,}); m=edges.size(); G[); G[to].push_back(m-); } struct Dinic{ int n,m,s,t; vector<Edge> edg…
题意:给出n,np,nc,m,n为节点数,np为发电站数,nc为用电厂数,m为边的个数.      接下来给出m个数据(u,v)z,表示w(u,v)允许传输的最大电力为z:np个数据(u)z,表示发电站的序号,以及最大的发电量:      nc个数据(u)z,表示用电厂的序号,以及最大的用电量.      最后让你求可以供整个网络使用的最大电力.思路:纯模板题.      这里主要是设一个源点s和一个汇点t,s与所有发电厂相连,边的最大容量为对应发电厂的最大发电量:      t与所有用电厂相连…