思路:暴力枚举答案,然后将点分层,边总是从该层连向下一层.然后判断最大流是不是满足题意.具体连边看代码.#include#include#include#include#includeusing namespace std;
#define INF ~0U>>1
struct Solver{
static const int V=50*100;
static const int E=2450*100*2;
int head[V],next[E],end[E],flow[E],ind;
int d[V],gap[V],stk[V],top,cur[V];
inline void reset(){
ind=top=0,memset(head,-1,sizeof head);
}
inline void addedge(int a,int b,int f){
int q=ind++;end[q]=b,next[q]=head[a],head[a]=q,flow[q]=f;
}
inline void make(int a,int b,int f){
/*printf("%d %d %d\n",a,b,f);*/addedge(a,b,f),addedge(b,a,0
...
继续阅读
(37)