From 10df00ff808c6681c31ff115e53fcaafa17d96d1 Mon Sep 17 00:00:00 2001 From: Noobie99 Date: Tue, 29 Aug 2023 09:40:24 +0200 Subject: small fix + consistency --- graph/maxCarBiMatch.cpp | 6 +++--- graph/minCostMaxFlow.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/graph/maxCarBiMatch.cpp b/graph/maxCarBiMatch.cpp index 0c5ac43..e928387 100644 --- a/graph/maxCarBiMatch.cpp +++ b/graph/maxCarBiMatch.cpp @@ -11,14 +11,14 @@ bool dfs(int v) { return false; } -int kuhn(int n) { // n = #Knoten links. +int kuhn(int l) { // l = #Knoten links. pairs.assign(sz(adj), -1); int ans = 0; // Greedy Matching. Optionale Beschleunigung. for (int v = 0; v < l; v++) for (int u : adj[v]) if (pairs[u] < 0) {pairs[u] = v; pairs[v] = u; ans++; break;} - for (int v = 0; v < n; v++) if (pairs[v] < 0) { - visited.assign(n, false); + for (int v = 0; v < l; v++) if (pairs[v] < 0) { + visited.assign(l, false); ans += dfs(v); } return ans; // Größe des Matchings. diff --git a/graph/minCostMaxFlow.cpp b/graph/minCostMaxFlow.cpp index 0e33ae4..3526b17 100644 --- a/graph/minCostMaxFlow.cpp +++ b/graph/minCostMaxFlow.cpp @@ -15,7 +15,7 @@ struct MinCostFlow { MinCostFlow(int n, int source, int target) : adj(n), s(source), t(target) {}; - void addedge(int u, int v, ll c, ll cost) { + void addEdge(int u, int v, ll c, ll cost) { adj[u].push_back(sz(edges)); edges.push_back({v, c, cost}); adj[v].push_back(sz(edges)); -- cgit v1.2.3