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…
题意: 就在一个给定的无向图中至少应该去掉几个顶点才干使得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有…
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…
http://poj.org/problem?id=1815 题意: 在现代社会,每个人都有自己的朋友.由于每个人都很忙,他们只通过电话联系.你可以假定A可以和B保持联系,当且仅当:①A知道B的电话号码:②A知道C的电话号码,而C能联系上B.如果A知道B的电话号码,则B也知道A的电话号码. 思路:这题是要我们删点,既然是删点,那么就要拆点,容量就是1. 接下来凡是能联系的,就连边,容量为INF,因为我们不是要删除这些边.跑遍最大流就能算出至少要删除多少个点. 这道题的关键是要字典序顺序输出最小割…
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 assume that people A can keep in touch with people B, only if  1. A knows B's phone number, or…
题目链接:http://poj.org/problem?id=1815 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 assume that people A can keep in touch with people B, only if 1. A kno…
Friendship Time Limit: 2000MS   Memory Limit: 20000K Total Submissions: 8025   Accepted: 2224 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…
[题意]给出一个无向图,和图中的两个点s,t.求至少去掉几个点后才能使得s和t不连通,输出这样的点集并使其字典序最大. 不错的题,有助于更好的理解最小割和求解最小割的方法~ [思路] 问题模型很简单,就是无向图的点连通度,也就是最小点割集.麻烦之处在于需要使得点割集方案的字典序最大.这样的话通常的dfs划分点集的方法就行不通了.我们采取贪心的策略:枚举1~N的点,在残留网络中dfs检查其代表的边的两端点是否连通,如果不连通则该点可以为点割,那么我们就让他是点割,加入到答案中,然后删掉这条边更新最…
妖怪题目,做到现在: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…
网络流的题总是出各种奇怪的错啊--没写过邻接表版的dinic,然后bfs扫到t点不直接return 1就会TTTTTLE-- 题目中的操作是"去掉人",很容易想到拆点,套路一般是(s,i')(i,t)(u',v)(v,u),然后关于输出顺序最小方案,可以枚举删点,如果删去一个点后求得最小割比原来的小,那么说明这个点在最小割中,就在图中删掉它并且把最小割标准-1,否则把这个点加回来. #include<iostream> #include<cstdio> #inc…