妖怪题目,做到现在: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…
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…
题意: 就在一个给定的无向图中至少应该去掉几个顶点才干使得s和t不联通. 算法: 假设s和t直接相连输出no answer. 把每一个点拆成两个点v和v'',这两个点之间连一条权值为1的边(残余容量) v和v''各自是一个流进的点.一个流出的点. 依据求最小割的性质.权值小的边是可能被选择的(断开的). 加入源点st=0和汇点en=2*n+1,源点与s连权值为inf的边.t''与汇点连权值为inf的边. s与s'',t与t''连权值为inf的边,这样保证自己和自己是不会失去联系的. 假设i和j有…
http://poj.org/problem? id=1815 Friendship Time Limit: 2000MS   Memory Limit: 20000K Total Submissions: 9026   Accepted: 2534 Description In modern society, each person has his own friends. Since all the people are very busy, they communicate with ea…
Friendship Time Limit: 2000MS   Memory Limit: 20000K Total Submissions: 10744   Accepted: 2984 Description In modern society, each person has his own friends. Since all the people are very busy, they communicate with each other only by phone. You can…
(点击此处查看原题) 题目分析 题意:有n个人,编号记为1~n,n个人之间可能有人可以互相联系,如果A能和B联系,那么至少满足这两种情况之一:(1)A知道B的电话(2)A可以和C联系,并且C可以和B联系: 因为某些人可能会丢失他的手机,导致他失去所有人的号码以及其他人手机中他的号码,也就是说这个人无法和任何人联系了: 此时给出两个人s,t,问至少有多少人失去他们的手机,可以使得这两个人s,t无法联系. 答案输出最少需要的人数以及失去手机的人的编号,如果存在多组解,输出字典序小的那一组. 思路:平…
[题意]给出一个无向图,和图中的两个点s,t.求至少去掉几个点后才能使得s和t不连通,输出这样的点集并使其字典序最大. 不错的题,有助于更好的理解最小割和求解最小割的方法~ [思路] 问题模型很简单,就是无向图的点连通度,也就是最小点割集.麻烦之处在于需要使得点割集方案的字典序最大.这样的话通常的dfs划分点集的方法就行不通了.我们采取贪心的策略:枚举1~N的点,在残留网络中dfs检查其代表的边的两端点是否连通,如果不连通则该点可以为点割,那么我们就让他是点割,加入到答案中,然后删掉这条边更新最…
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…