diff options
| author | Noobie99 <noob999noob999@gmail.com> | 2023-08-29 09:40:24 +0200 |
|---|---|---|
| committer | Noobie99 <noob999noob999@gmail.com> | 2023-08-29 09:40:24 +0200 |
| commit | 10df00ff808c6681c31ff115e53fcaafa17d96d1 (patch) | |
| tree | c6b6a30144e4f16ef8b8af5cdaf6a4cc5bff20e1 /graph | |
| parent | bc7a54f2a10ff3bb76cf4920be53000264bad279 (diff) | |
small fix + consistency
Diffstat (limited to 'graph')
| -rw-r--r-- | graph/maxCarBiMatch.cpp | 6 | ||||
| -rw-r--r-- | 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)); |
