Skip to content

Commit 00e5f49

Browse files
lrvideckisweb-flow
andauthored
Nits (#199)
* make function * [auto-verifier] verify commit f0d14b6 * add more comments --------- Co-authored-by: GitHub <noreply@github.com>
1 parent 9fb0981 commit 00e5f49

4 files changed

Lines changed: 24 additions & 20 deletions

File tree

.verify-helper/timestamps.remote.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp": "2026-01-22 10:08:22 -0700",
7878
"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2026-03-16 14:36:46 -0600",
7979
"tests/library_checker_aizu_tests/handmade_tests/fib_matrix_expo.test.cpp": "2026-01-28 21:48:16 -0700",
80-
"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2025-08-06 16:18:37 -0600",
80+
"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2026-03-24 10:50:28 -0600",
8181
"tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp": "2026-01-18 02:20:40 +0000",
8282
"tests/library_checker_aizu_tests/handmade_tests/kd_bit.test.cpp": "2026-02-19 18:06:52 -0700",
8383
"tests/library_checker_aizu_tests/handmade_tests/manacher.test.cpp": "2026-01-18 11:15:41 +0000",

library/data_structures_[l,r)/seg_tree.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
//! });
88
//! tree st(n, LLONG_MAX, ranges::min);
99
//! st.max_right(l, r, [&](int m, ll value) {
10+
//! // l < m <= r
1011
//! // value = op(a[l], a[l+1], ..., a[m-1])
1112
//! return value <= x;
1213
//! });
1314
//! st.min_left(l, r, [&](int m, ll value) {
15+
//! // l <= m < r
1416
//! // value = op(a[m], ..., a[r-2], a[r-1])
1517
//! return value <= x;
1618
//! });

library/data_structures_[l,r]/seg_tree.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
//! });
77
//! tree st(n, LLONG_MAX, ranges::min);
88
//! st.max_right(l, r, [&](int m, ll value) {
9+
//! // l <= m <= r
910
//! // value = op(a[l], a[l+1], ..., a[m])
1011
//! return value <= x;
1112
//! });
1213
//! st.min_left(l, r, [&](int m, ll value) {
14+
//! // l <= m <= r
1315
//! // value = op(a[m], ..., a[r-1], a[r])
1416
//! return value <= x;
1517
//! });

library/graphs/uncommon/functional_graph_processor.hpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@
1111
//! t[v].childs = forest of reversed edges not in cycles
1212
//! @time O(n)
1313
//! @space O(n)
14-
struct func_graph {
15-
vector<pii> root_of;
16-
vector<vi> cycle, childs;
17-
func_graph(const vi& a): root_of(sz(a)), childs(sz(a)) {
18-
vi vis(sz(a));
19-
rep(i, 0, sz(a)) if (!vis[i]) {
20-
int u = i;
21-
for (; !vis[u]; u = a[u]) vis[u] = 1;
22-
if (vis[u] == 1)
23-
for (cycle.emplace_back(); vis[u] == 1; u = a[u]) {
24-
root_of[u] = {sz(cycle) - 1, sz(cycle.back())};
25-
cycle.back().push_back(u);
26-
vis[u] = 2;
27-
}
28-
for (int v = i; vis[v] == 1; v = a[v]) {
29-
root_of[v] = root_of[u];
30-
childs[a[v]].push_back(v);
31-
vis[v] = 2;
14+
auto func_graph(const vi& a) {
15+
int n = sz(a);
16+
vector<pii> root_of(n);
17+
vector<vi> cycle, childs(n);
18+
vi vis(n);
19+
rep(i, 0, n) if (!vis[i]) {
20+
int u = i;
21+
for (; !vis[u]; u = a[u]) vis[u] = 1;
22+
if (vis[u] == 1)
23+
for (cycle.emplace_back(); vis[u] == 1; u = a[u]) {
24+
root_of[u] = {sz(cycle) - 1, sz(cycle.back())};
25+
cycle.back().push_back(u);
26+
vis[u] = 2;
3227
}
28+
for (int v = i; vis[v] == 1; v = a[v]) {
29+
root_of[v] = root_of[u];
30+
childs[a[v]].push_back(v);
31+
vis[v] = 2;
3332
}
3433
}
35-
};
34+
return tuple{root_of, cycle, childs};
35+
}

0 commit comments

Comments
 (0)