diff options
Diffstat (limited to 'graph')
| -rw-r--r-- | graph/LCA.cpp | 6 | ||||
| -rw-r--r-- | graph/capacityScaling.cpp | 6 | ||||
| -rw-r--r-- | graph/pushRelabel2.cpp | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/graph/LCA.cpp b/graph/LCA.cpp index bdb8f12..027d101 100644 --- a/graph/LCA.cpp +++ b/graph/LCA.cpp @@ -16,9 +16,9 @@ int getLCA(int a, int b) { void exampleUse() { int c = 0; - visited = vector<int>(2*adjlist.size()); - first = vector<int>(adjlist.size(), 2*adjlist.size()); - depth = vector<int>(2*adjlist.size()); + visited = vector<int>(2*sz(adjlist)); + first = vector<int>(sz(adjlist), 2*sz(adjlist)); + depth = vector<int>(2*sz(adjlist)); initLCA(0, 0, c); init(depth); } diff --git a/graph/capacityScaling.cpp b/graph/capacityScaling.cpp index b59c322..8467f81 100644 --- a/graph/capacityScaling.cpp +++ b/graph/capacityScaling.cpp @@ -10,9 +10,9 @@ vector<int> visited; ll capacity; void addEdge(int from, int to, ll c) { - adjlist[from].push_back(edges.size()); + adjlist[from].push_back(sz(edges)); edges.push_back({from, to, 0, c}); - adjlist[to].push_back(edges.size()); + adjlist[to].push_back(sz(edges)); edges.push_back({to, from, 0, 0}); } @@ -34,7 +34,7 @@ ll maxFlow(int source, int target) { s = source; t = target; ll flow = 0; - visited.assign(adjlist.size(), 0); + visited.assign(sz(adjlist), 0); dfsCounter = 0; while (capacity) { while (dfsCounter++, dfs(s)) flow += capacity; diff --git a/graph/pushRelabel2.cpp b/graph/pushRelabel2.cpp index 8b5f0c6..343f71d 100644 --- a/graph/pushRelabel2.cpp +++ b/graph/pushRelabel2.cpp @@ -14,9 +14,9 @@ vector<list<int>::iterator> iter; int highest, highestActive; void addEdge(int from, int to, ll c) { - adjlist[from].push_back(edges.size()); + adjlist[from].push_back(sz(edges)); edges.push_back({from, to, 0, c}); - adjlist[to].push_back(edges.size()); + adjlist[to].push_back(sz(edges)); edges.push_back({to, from, 0, 0}); } @@ -79,7 +79,7 @@ void discharge(int n, int u) { }} ll maxFlow(int s, int t) { - int n = adjlist.size(); + int n = sz(adjlist); llist.assign(n + 1, {}); dlist.assign(n + 1, {}); highestActive = highest = 0; |
