Skip to content

Commit cec9d7b

Browse files
lrvideckisweb-flow
andauthored
golf (#136)
* Update cuts_callback.hpp * [auto-verifier] verify commit cbaaa72 * more golf * [auto-verifier] verify commit 408c4e1 * more golf * [auto-verifier] verify commit fa49926 --------- Co-authored-by: GitHub <noreply@github.com>
1 parent 420483e commit cec9d7b

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

.verify-helper/timestamps.remote.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"tests/library_checker_aizu_tests/flow/min_cost_max_flow.test.cpp": "2024-12-05 10:41:42 -0600",
5353
"tests/library_checker_aizu_tests/graphs/biconnected_components.test.cpp": "2025-02-10 23:30:47 -0700",
5454
"tests/library_checker_aizu_tests/graphs/connected_components_of_complement_graph.test.cpp": "2024-12-14 19:50:29 -0600",
55-
"tests/library_checker_aizu_tests/graphs/cuts_callback.test.cpp": "2025-06-23 04:22:44 -0600",
55+
"tests/library_checker_aizu_tests/graphs/cuts_callback.test.cpp": "2025-06-23 04:31:17 -0600",
5656
"tests/library_checker_aizu_tests/graphs/dijkstra_aizu.test.cpp": "2024-12-14 19:50:29 -0600",
5757
"tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp": "2024-12-14 19:50:29 -0600",
5858
"tests/library_checker_aizu_tests/graphs/directed_cycle.test.cpp": "2025-02-10 23:30:47 -0700",

library/graphs/bridges_cuts/cuts_callback.hpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,18 @@
1515
void cuts_callback(const auto& adj, auto f) {
1616
int n = sz(adj), q = 0, s = 0;
1717
vi tin(n), st(n);
18-
auto dfs = [&](auto&& self, int v, int p) -> int {
19-
int low = tin[v] = ++q;
20-
for (int u : adj[v])
21-
if (u != p) {
22-
int siz = s, lu = 0;
23-
low = min(low,
24-
tin[u] ?: (lu = self(self, st[s++] = u, v)));
25-
if (lu >= tin[v]) {
26-
st[s++] = v;
27-
f(vi(siz + all(st) - n + s));
28-
s = siz;
29-
}
18+
auto dfs = [&](auto&& self, int v) -> int {
19+
int l = tin[v] = ++q;
20+
for (int u : adj[v]) {
21+
int siz = s, lu = 0;
22+
l = min(l, tin[u] ?: (lu = self(self, st[s++] = u)));
23+
if (lu >= tin[v]) {
24+
st[s++] = v;
25+
f(vi(siz + all(st) - n + s));
26+
s = siz;
3027
}
31-
return low;
28+
}
29+
return l;
3230
};
33-
rep(i, 0, n) if (!tin[i]) dfs(dfs, i, i);
31+
rep(i, 0, n) if (!tin[i]) dfs(dfs, i);
3432
}

0 commit comments

Comments
 (0)