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…
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…
题目大意:一个有源有汇的城市,问最少增加城市中的多少道路可以增加源到汇上各个路径上可容纳的总车流量增加. 网络流关键割边集合指如果该边的容量增加,整个网络流图中的任意从原点到汇点的路径的流量便可增加. 从源点开始遍历未满流的边,这些边两端节点的集合称为S:同理再从汇点开始遍历,集合称为T:其余的点组成另一个集合.如果一个边是最小割,则其两端属于不同的集合.如果一个边是关键割边,则该边两端节点一个属于S,一个属于T.遍历每一个图中的边,看它是否满足该条件即可. #include <cstdio>…
Ikki's Story IV - Panda's Trick Time Limit: 1000MS   Memory Limit: 131072K Total Submissions: 7296   Accepted: 2705 Description liympanda, one of Ikki’s friend, likes playing games with Ikki. Today after minesweeping with Ikki and winning so many tim…
http://poj.org/problem?id=3207 Ikki's Story IV - Panda's Trick Time Limit: 1000MS   Memory Limit: 131072K Total Submissions: 7021   Accepted: 2604 Description liympanda, one of Ikki’s friend, likes playing games with Ikki. Today after minesweeping wi…