传送门
脑残题
建图都懒得说了
——代码
1 #include <queue> 2 #include <cstdio> 3 #include <cstring> 4 #include <iostream> 5 #define N 1000001 6 #define min(x, y) ((x) < (y) ? (x) : (y)) 7 8 int n, cnt, s, t; 9 int a[101][101], dis[N], pre[N]; 10 int head[N], to[N << 1], val[N << 1], cost[N << 1], next[N << 1]; 11 bool vis[N]; 12 13 inline int read() 14 21 22 inline void add(int x, int y, int z, int c) 23 30 31 inline bool spfa() 32 56 } 57 } 58 } 59 return pre[t] ^ 1; 60 } 61 62 inline int dinic() 74 sum += dis[t] * d; 75 } 76 return sum; 77 } 78 79 int main() 80 97 } 98 printf("%d\n", dinic()); 99 cnt = 0; 100 memset(head, 1, sizeof(head)); 101 for(i = 1; i <= n; i++) 102 112 } 113 printf("%d\n", dinic()); 114 return 0; 115 }View Code
上一篇:[luoguP3275] [SCOI2011]糖果(差分约束)
下一篇:[HDU3038]How Many Answers Are Wrong(并查集)
网络流 最小费用最大流









