题意: 就在一个给定的无向图中至少应该去掉几个顶点才干使得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…
题目链接:http://poj.org/problem?id=1815 思路:题目要求是剔除多少个点,可以将其转化为剔除多少条边,因此需要拆点,将点i拆成i,i+n,便容量为1,表示每个人起的传递作用只能是一次.然后就是枚举了,删除某条边,如果求出的最小割比原来的要小,说明减少的是割边集. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<…
(点击此处查看原题) 题目分析 题意:有n个人,编号记为1~n,n个人之间可能有人可以互相联系,如果A能和B联系,那么至少满足这两种情况之一:(1)A知道B的电话(2)A可以和C联系,并且C可以和B联系: 因为某些人可能会丢失他的手机,导致他失去所有人的号码以及其他人手机中他的号码,也就是说这个人无法和任何人联系了: 此时给出两个人s,t,问至少有多少人失去他们的手机,可以使得这两个人s,t无法联系. 答案输出最少需要的人数以及失去手机的人的编号,如果存在多组解,输出字典序小的那一组. 思路:平…
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…
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…
http://poj.org/problem?id=1815 题意: 在现代社会,每个人都有自己的朋友.由于每个人都很忙,他们只通过电话联系.你可以假定A可以和B保持联系,当且仅当:①A知道B的电话号码:②A知道C的电话号码,而C能联系上B.如果A知道B的电话号码,则B也知道A的电话号码. 思路:这题是要我们删点,既然是删点,那么就要拆点,容量就是1. 接下来凡是能联系的,就连边,容量为INF,因为我们不是要删除这些边.跑遍最大流就能算出至少要删除多少个点. 这道题的关键是要字典序顺序输出最小割…
题目链接: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…
网络流的题总是出各种奇怪的错啊--没写过邻接表版的dinic,然后bfs扫到t点不直接return 1就会TTTTTLE-- 题目中的操作是"去掉人",很容易想到拆点,套路一般是(s,i')(i,t)(u',v)(v,u),然后关于输出顺序最小方案,可以枚举删点,如果删去一个点后求得最小割比原来的小,那么说明这个点在最小割中,就在图中删掉它并且把最小割标准-1,否则把这个点加回来. #include<iostream> #include<cstdio> #inc…
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…