bzoj3931[CQOI2015]网络吞吐量

天呐手贱打错了WA了N次好吧这不是重点

题意即题解

/**************************************************************
    Problem: 3931
    User: BPM136
    Language: C++
    Result: Accepted
    Time:216 ms
    Memory:7984 kb
****************************************************************/
 
#include
#include
#include
#include
#include
#include
#include
#define LL long long
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define efo(i,x) for(int i=last[x];i!=0;i=e[i].next)
using namespace std;
inline LL read()
{
    LL d=0,f=1;char s=getchar();
    while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}
    while(s>='0'&&s<='9'){d=d*10+s-'0';s=getchar();}
    return f*d;
}
#define N 505
#define M 100005
#define inf 10000000000000LL
LL a[N][N];
struct edg
{
    int x,y;
    LL w;
}ee[M];
struct edge
{
    int y,next;
    LL f;
}e[M*2];
int last[N*2],ne=1;
int n,m;
 
void add(int x,int y,LL f)
{
    e[++ne].y=y;e[ne].f=f;e[ne].next=last[x];last[x]=ne;
}
 
void add2(int x,int y,LL f)
{
    add(x,y,f);add(y,x,0);
}
 
void init1()
{
    n=read(),m=read();
    fo(i,1,m)
    {
        int x=read(),y=read();
        LL w=read();
//      add2(x,y,w);
        ee[i].x=x;ee[i].y=y;ee[i].w=w;
        if(a[x][y]==0)
        {
            a[x][y]=w;
            a[y][x]=w;
        }
        else
        {
            a[x][y]=min(a[x][y],w);
            a[y][x]=a[x][y];
        }
    }
}
 
LL dis[N];
bitsetv;
void dijkstra()
{
    v.reset();
    fo(i,0,N-1)dis[i]=inf;
    dis[1]=0;
    while(1)
    {
        LL mi=inf;
        int u=0;
        fo(i,1,n)
        if(v[i]==0&&dis[i]


你可能感兴趣的:(网络流)