【多校赛第三场】Redraw Beautiful Drawings【网络流】【谜のWA】

2020-12-13 05:54

阅读:284

标签:blog   http   os   io   for   art   ar   line   

 

参考题解:http://blog.csdn.net/qian99/article/details/38276887

 

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
int m,n,K;
const int INF=1 G[MAX_V];
bool used[MAX_V];
bool vis[MAX_V];
int mat[MAX_V][MAX_V];
int level[MAX_V];
int iter[MAX_V];
void add_edge(int from,int to,int cap){
    G[from].push_back((edge){to,cap,G[to].size()});
    G[to].push_back((edge){from,0,G[from].size()-1});
}
void bfs(int s){
    memset(level,-1,sizeof(level));
    queue que;
    level[s]=0;
    que.push(s);
    while(!que.empty()){
        int v=que.front();que.pop();
        for(int i=0;i0 && level[e.to]0 && level[v]0){
                e.cap-=d;
                G[e.to][e.rev].cap+=d;
                return d;
            }
        }
    }
    return 0;
}
int max_flow(int s,int t){
    int flow=0;
    for(;;){
        bfs(s);
        if(level[t]0){
            flow+=f;
        }
    }
}
bool mydfs(int now,int fa){
    //vis[now]=true;//为什么我加上这句就WA了?
    for(int i=0;i


 

【多校赛第三场】Redraw Beautiful Drawings【网络流】【谜のWA】,搜素材,soscw.com

【多校赛第三场】Redraw Beautiful Drawings【网络流】【谜のWA】

标签:blog   http   os   io   for   art   ar   line   

原文地址:http://blog.csdn.net/u011775691/article/details/38362929


评论


亲,登录后才可以留言!