Skip to content
Merged

Nits #199

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .verify-helper/timestamps.remote.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp": "2026-01-22 10:08:22 -0700",
"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2026-03-16 14:36:46 -0600",
"tests/library_checker_aizu_tests/handmade_tests/fib_matrix_expo.test.cpp": "2026-01-28 21:48:16 -0700",
"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2025-08-06 16:18:37 -0600",
"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2026-03-24 10:50:28 -0600",
"tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/handmade_tests/kd_bit.test.cpp": "2026-02-19 18:06:52 -0700",
"tests/library_checker_aizu_tests/handmade_tests/manacher.test.cpp": "2026-01-18 11:15:41 +0000",
Expand Down
2 changes: 2 additions & 0 deletions library/data_structures_[l,r)/seg_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
//! });
//! tree st(n, LLONG_MAX, ranges::min);
//! st.max_right(l, r, [&](int m, ll value) {
//! // l < m <= r
//! // value = op(a[l], a[l+1], ..., a[m-1])
//! return value <= x;
//! });
//! st.min_left(l, r, [&](int m, ll value) {
//! // l <= m < r
//! // value = op(a[m], ..., a[r-2], a[r-1])
//! return value <= x;
//! });
Expand Down
2 changes: 2 additions & 0 deletions library/data_structures_[l,r]/seg_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
//! });
//! tree st(n, LLONG_MAX, ranges::min);
//! st.max_right(l, r, [&](int m, ll value) {
//! // l <= m <= r
//! // value = op(a[l], a[l+1], ..., a[m])
//! return value <= x;
//! });
//! st.min_left(l, r, [&](int m, ll value) {
//! // l <= m <= r
//! // value = op(a[m], ..., a[r-1], a[r])
//! return value <= x;
//! });
Expand Down
38 changes: 19 additions & 19 deletions library/graphs/uncommon/functional_graph_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@
//! t[v].childs = forest of reversed edges not in cycles
//! @time O(n)
//! @space O(n)
struct func_graph {
vector<pii> root_of;
vector<vi> cycle, childs;
func_graph(const vi& a): root_of(sz(a)), childs(sz(a)) {
vi vis(sz(a));
rep(i, 0, sz(a)) if (!vis[i]) {
int u = i;
for (; !vis[u]; u = a[u]) vis[u] = 1;
if (vis[u] == 1)
for (cycle.emplace_back(); vis[u] == 1; u = a[u]) {
root_of[u] = {sz(cycle) - 1, sz(cycle.back())};
cycle.back().push_back(u);
vis[u] = 2;
}
for (int v = i; vis[v] == 1; v = a[v]) {
root_of[v] = root_of[u];
childs[a[v]].push_back(v);
vis[v] = 2;
auto func_graph(const vi& a) {
int n = sz(a);
vector<pii> root_of(n);
vector<vi> cycle, childs(n);
vi vis(n);
rep(i, 0, n) if (!vis[i]) {
int u = i;
for (; !vis[u]; u = a[u]) vis[u] = 1;
if (vis[u] == 1)
for (cycle.emplace_back(); vis[u] == 1; u = a[u]) {
root_of[u] = {sz(cycle) - 1, sz(cycle.back())};
cycle.back().push_back(u);
vis[u] = 2;
}
for (int v = i; vis[v] == 1; v = a[v]) {
root_of[v] = root_of[u];
childs[a[v]].push_back(v);
vis[v] = 2;
}
}
};
return tuple{root_of, cycle, childs};
}
Loading