# NOI2008 志愿者招募

/**************************************************************
Problem: 1061
User: Gvolv
Language: C++
Result: Accepted
Time:1392 ms
Memory:4792 kb
****************************************************************/

#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<queue>
#define LL long long
#define INF 1000000000
#define eps 1e-10
#define sqr(x) (x)*(x)
#define pa pair<int,int>
#define cyc(i,x,y) for(i=(x);i<=(y);i++)
#define cy2(i,x,y) for(i=(x);i>=(y);i--)
using namespace std;
{
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=10*x+ch-'0';ch=getchar();}
return x*f;
}
#define N 100030
int d[N],v[N];
struct Node{
int from,go,next,v,c;
}e[N];
void addedge(int x,int y,int z,int c)
{
}
queue<int> q;
int spfa()
{
for(int i=s;i<=t;i++) d[i]=INF,v[i]=0;
d[s]=0;v[s]=1;q.push(s);
while(!q.empty())
{
int x=q.front();q.pop();v[x]=0;
if(e[i].v&&d[x]+e[i].c<d[y=e[i].go])
{
d[y]=d[x]+e[i].c;from[y]=i;
if(!v[y]) {v[y]=1;q.push(y);}
}
}
return d[t]!=INF;
}
int mcf()
{
int mincost=0;
while(spfa())
{
int tmp=INF;
for(int i=from[t];i;i=from[e[i].from]) tmp=min(tmp,e[i].v);
mincost+=tmp*d[t];
for(int i=from[t];i;i=from[e[i].from])e[i].v-=tmp,e[i^1].v+=tmp;
}
return mincost;
}
int main()
{
//  freopen("input.in","r",stdin);
//  freopen("output.out","w",stdout);
int i,x,y,z,o=0;
s=0,t=n+2;
cyc(i,1,n)
{
}
cyc(i,1,m)
{
}
printf("%d\n",mcf());
return 0;
}

#### 【NOI2008】BZOJ1061志愿者招募

2016-03-12 15:33:17

#### bzoj1061【NOI2008】志愿者招募

2015-12-18 23:00:58

#### [bzoj1061][NOI2008]志愿者招募

2016-03-14 19:45:16

#### [BZOJ1061] [NOI2008] 志愿者招募 - 最小费用最大流

2016-04-05 23:25:23

#### 【BZOJ】1061 [Noi2008]志愿者招募 最小费用最大流——预流&填坑

2014-10-08 22:03:09

#### BZOJ1061: [Noi2008]志愿者招募 && 单纯形学习笔记

2017-01-05 11:40:07

#### 1061: [Noi2008]志愿者招募 费用流

2016-01-23 08:07:23

#### bzoj3265 noi2008志愿者招募 【线性规划】

2017-05-28 14:25:54

#### BZOJ 1061 [Noi2008]志愿者招募 线性规划

2015-08-21 18:38:54

#### bzoj1061 [Noi2008]志愿者招募（线性规划/费用流）

2017-12-26 09:06:55