Skip to content

Commit 70f1aab

Browse files
lrvideckisweb-flow
andauthored
Seg tree nit (#173)
* Update seg_tree.hpp * [auto-verifier] verify commit 1296461 * Format constructor for better readability * [auto-verifier] verify commit 78ccda0 * update docs Updated segment tree example code in comments. * [auto-verifier] verify commit 611f33d --------- Co-authored-by: GitHub <noreply@github.com>
1 parent 8c87cf8 commit 70f1aab

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

.verify-helper/timestamps.remote.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
"tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp": "2026-01-18 11:15:41 +0000",
4545
"tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp": "2026-01-18 11:15:41 +0000",
4646
"tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-01-18 11:15:41 +0000",
47-
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-01-18 11:15:41 +0000",
48-
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-01-18 11:15:41 +0000",
47+
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-01-21 23:24:08 -0700",
48+
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-01-21 23:24:08 -0700",
4949
"tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-01-18 11:15:41 +0000",
5050
"tests/library_checker_aizu_tests/flow/dinic_aizu.test.cpp": "2024-11-17 14:04:03 -0600",
5151
"tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2024-11-17 14:04:03 -0600",

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
//! https://codeforces.com/blog/entry/118682
33
//! @code
44
//! {
5-
//! tree st(n, pii{}, [&](pii& l, pii& r) {
6-
//! return min(l, r);
5+
//! tree st(n, 0LL, [&](ll l, ll r) {
6+
//! return l + r;
77
//! });
88
//! }
9-
//! tree st(n, int{}, ranges::min);
10-
//! rep(i, 0, n) st.update(i, a[i]);
9+
//! tree st(n, INT_MAX, ranges::min);
1110
//! @endcode
1211
//! @time O(n + q log n)
1312
//! @space O(n)
@@ -19,7 +18,8 @@ template<class T, class F> struct tree {
1918
int n;
2019
F op;
2120
vector<T> s;
22-
tree(int n, T, F op): n(n), op(op), s(2 * n) {}
21+
tree(int n, T unit, F op):
22+
n(n), op(op), s(2 * n, unit) {}
2323
void update(int i, T val) {
2424
for (s[i += n] = val; i /= 2;)
2525
s[i] = op(s[2 * i], s[2 * i + 1]);

0 commit comments

Comments
 (0)