Ikki's Story I - Road Reconstruction Time Limit: 2000MS   Memory Limit: 131072K Total Submissions: 7659   Accepted: 2215 Description Ikki is the king of a small country – Phoenix, Phoenix is so small that there is only one city that is responsible fo…
Ikki's Story I - Road Reconstruction Time Limit: 2000MS   Memory Limit: 131072K Total Submissions: 7971   Accepted: 2294 Description Ikki is the king of a small country – Phoenix, Phoenix is so small that there is only one city that is responsible fo…
[题意]给定一个N个节点M条边的网络流,求有多少条边,使得当增其中加任何一个边的容量后,整个网络的流将增加. 挺好的一道题,考察对网络流和增广路的理解. [思路] 首先关键边一定是满流边.那么对于一个满流边<x,y>来说,如果残余网络中从起点到x和从y到终点都有路径可达的话,那么这条边的容量增加时,在残量网络上将会产生一条增广路,最大流的值一定会发生改变. 则算法如下: 求最大流,得到残余网络 枚举每条满流边,DFS判断是否分别从源点和到汇点可达,如果可达则加1. #include #incl…
求一次最大流后,分别对所有满流的边的容量+1,然后看是否存在增广路. #include<cstdio> #include<cstring> #include<queue> #include<algorithm> using namespace std; #define INF (1<<30) #define MAXN 555 #define MAXM 11111 struct Edge{ int v,cap,flow,next; }edge[MA…
题意: 给一个有向图 求给那些边增加容量能增加总的流量,求边的条数 分析: 一开始求的是割边,结果wa了,那是因为有些割边增加了容量,但总的容量也不会增加 只有满流的边并且从源点汇点都有一条可扩展的路时,才满足条件 因此,求完最大流后,在从源汇两点dfs,找扩展路.然后枚举边即可 // File Name: 3204.cpp // Author: Zlbing // Created Time: 2013年08月15日 星期四 14时59分13秒 #include<iostream> #incl…
Ikki's Story I - Road Reconstruction Time Limit: 2000MS   Memory Limit: 131072K Total Submissions: 7491   Accepted: 2172 Description Ikki is the king of a small country – Phoenix, Phoenix is so small that there is only one city that is responsible fo…
POJ 3207 Ikki's Story IV - Panda's Trick(2-sat问题) Description liympanda, one of Ikki's friend, likes playing games with Ikki. Today after minesweeping with Ikki and winning so many times, he is tired of such easy games and wants to play another game…
POJ 3207 Ikki's Story IV - Panda's Trick id=3207" target="_blank" style="">题目链接 题意:一个圆上顺序n个点,然后有m组连线,连接两点,要求这两点能够往圆内或圆外.问能否构造出使得满足全部线段不相交 思路:2-sat,推断相交的建边,一个在内.一个在外,然后跑一下2-sat就可以 代码: #include <cstdio> #include <cstring…
题意:有一个矩阵,某些格有人,某些格有房子,每个人可以上下左右移动,问给每个人进一个房子,所有人需要走的距离之和最小是多少. 貌似以前见过很多这样类似的题,都不会,现在知道是用KM算法做了 KM算法目前还没弄懂,先套模板做 Sample Input 2 2 .m H. 5 5 HH..m ..... ..... ..... mm..H 7 8 ...H.... ...H.... ...H.... mmmHmmmm ...H.... ...H.... ...H.... 0 0 Sample Out…
POJ 3436 ACM Computer Factory (网络流,最大流) Description As you know, all the computers used for ACM contests must be identical, so the participants compete on equal terms. That is why all these computers are historically produced at the same factory. Eve…