# ●BZOJ 1934 [Shoi2007]Vote 善意的投票

http://www.lydsy.com/JudgeOnline/problem.php?id=1934

S向为1的点连边，为0的点向T连边，

#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#define MAXN 350
#define INF 0x3f3f3f3f
using namespace std;
struct Edge{
void Init(){
}
to[ent]=v; cap[ent]=w;
to[ent]=u; cap[ent]=0;
}
int Next(bool type,int i){
}
}E;
int N,M,T,S;
int d[MAXN],cur[MAXN];
bool bfs(){
memset(d,0,sizeof(d));
queue<int>q; q.push(S); d[S]=1;
while(!q.empty()){
int u=q.front(); q.pop();
for(int i=E.Next(1,u);i;i=E.Next(0,i)){
int v=E.to[i];
if(d[v]||!E.cap[i]) continue;
d[v]=d[u]+1; q.push(v);
}
}
return d[T];
}
int dfs(int u,int reflow){
if(!reflow||u==T) return reflow;
int flowout=0,f;
for(int &i=cur[u];i;i=E.Next(0,i)){
int v=E.to[i];
if(d[v]!=d[u]+1) continue;
f=dfs(v,min(reflow,E.cap[i]));
reflow-=f; E.cap[i]-=f;
flowout+=f; E.cap[i^1]+=f;
if(!reflow) break;
}
if(!flowout) d[u]=0;
return flowout;
}
int Dinic(){
int flow=0;
while(bfs()){
flow+=dfs(S,INF);
}
return flow;
}
int main()
{
scanf("%d%d",&N,&M); S=N+1,T=N+2;
E.Init();
for(int i=1,x;i<=N;i++){
scanf("%d",&x);
}