| 10 | flow_network(int _n) : n(_n), head(n,-1) { } |
| 11 | void reset() { e = e_store; } |
| 12 | void add_edge(int u, int v, int cost, int uv, int vu=0) { |
| 13 | e.push_back(edge(v, uv, cost, head[u])); |
| 14 | head[u] = (int)size(e)-1; |
| 15 | e.push_back(edge(u, vu, -cost, head[v])); |
| 16 | head[v] = (int)size(e)-1; } |
| 17 | ii min_cost_max_flow(int s, int t, bool res=true) { |
| 18 | e_store = e; |
| 19 | memset(pot, 0, n*sizeof(int)); |