Skip to content

Commit e75dba6

Browse files
committed
Rename methods of Li-Chao tree
1 parent e1cb4d0 commit e75dba6

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

convex_hull_trick/li_chao_tree.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
// Li-Chao tree
88
// init() : set x's where we will execute get(x) queries
9-
// add_segment(l, r, a, b): update by ax + b in [l, r)
9+
// insert_segment(l, r, a, b): update by ax + b in [l, r)
1010
// get(x): get min
1111
template <class T, class T_MP> struct li_chao_tree {
1212
int _n, _head;
@@ -78,12 +78,12 @@ template <class T, class T_MP> struct li_chao_tree {
7878
}
7979
}
8080

81-
void add_line(T a, T b, int idx = -1) {
81+
void insert_line(T a, T b, int idx = -1) {
8282
il = 0, ir = _n;
8383
if (il >= ir) return;
8484
_rec(1, 0, _head, _Line{a, b, idx, true});
8585
}
86-
void add_segment(T xl, T xr, T a, T b, int idx = -1) {
86+
void insert_segment(T xl, T xr, T a, T b, int idx = -1) {
8787
il = std::lower_bound(xs.begin(), xs.end(), xl) - xs.begin();
8888
ir = std::lower_bound(xs.begin(), xs.end(), xr) - xs.begin();
8989
if (il >= ir) return;

convex_hull_trick/li_chao_tree.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ vector<long long> xs;
1313
li_chao_tree<long long, __int128> tree;
1414
tree.init(xs); // xs が昇順である必要はない
1515

16-
tree.add_segment(l, r, a, b, 0); // chmin by ax + b in [l, r)
16+
tree.insert_segment(l, r, a, b, 0); // chmin by ax + b in [l, r)
1717

1818
ret = tree.get(x);
1919
cout << ret.minval << endl;

convex_hull_trick/test/li_chao_tree.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ int main() {
3636

3737
for (auto q : qs) {
3838
tie(tp, l, r, a, b) = q;
39-
if (tp == 0) tree.add_segment(l, r, a, b, 0);
39+
if (tp == 0) tree.insert_segment(l, r, a, b, 0);
4040
if (tp == 1) {
4141
auto ret = tree.get(l);
4242
if (ret.is_valid) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy