「网络流 24 题」数字梯形
直接拆点做,但就是搞不懂为什么wa掉了第一小问.... 不管了 #include<bits/stdc++.h> using namespace std; long long tot=-1,sum=0,h[20005],flow[20005],g[20005],ans=0,dis[20005],ans2=0,inf=9999999; bool vis[20005]; struct node{ long long from,to,next,rest,cost; }e[10000005]; void add(long long x,long long y,long long z,long long hg){ tot++; e[tot].next=h[x]; h[x]=tot; e[tot].cost=hg; e[tot].from=x; e[tot].to=y; e[tot].rest=z; } int bfs(long long s,long long t){ queue<int>q; q.push(s);dis[s]=0;vis[s]=true; while(!q.empty()){ long long u=q.front();q.pop();//vis[u]=false; for(int i=h[u];i!=(-1);i=e[i].next){ if(e[i].rest>0&