1
0
Fork 0

Update graph/mcmf.cc

Signed-off-by: subcrip <contact@subc.rip>
This commit is contained in:
subcrip 2024-05-19 12:57:42 +08:00
parent 3809174648
commit c97b1b71a9
1 changed files with 4 additions and 3 deletions

View File

@ -5,6 +5,7 @@ struct mcmf {
ll flow; ll flow;
ll cost; ll cost;
int rev; int rev;
bool mark;
}; };
vector<vector<edge>> edges; vector<vector<edge>> edges;
@ -14,9 +15,9 @@ struct mcmf {
mcmf(int n) : edges(n + 1), dis(n + 1), vis(n + 1) {} mcmf(int n) : edges(n + 1), dis(n + 1), vis(n + 1) {}
void add_edge(int from, int to, ll cap, ll cost) { void add_edge(int from, int to, ll cap, ll cost, bool mark = false) {
edges[from].push_back({ to, cap, 0, cost, int(edges[to].size()) }); edges[from].push_back({ to, cap, 0, cost, int(edges[to].size()), mark });
edges[to].push_back({ from, 0, 0, -cost, int(edges[from].size() - 1)}); edges[to].push_back({ from, 0, 0, -cost, int(edges[from].size() - 1), mark });
} }
bool sp(int s, int t) { bool sp(int s, int t) {