From b40b4fbc8222226608c64013e56226044884374e Mon Sep 17 00:00:00 2001 From: mzuenni Date: Thu, 23 Feb 2023 14:57:25 +0100 Subject: changed names --- datastructures/lazyPropagation.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'datastructures/lazyPropagation.cpp') diff --git a/datastructures/lazyPropagation.cpp b/datastructures/lazyPropagation.cpp index 4817b16..ed5438f 100644 --- a/datastructures/lazyPropagation.cpp +++ b/datastructures/lazyPropagation.cpp @@ -61,15 +61,15 @@ struct SegTree { } // Optional: - ll find_first(int l, int r, int x) { + ll lower_bound(int l, int r, int x) { l += size, r += size; push(l), push(r - 1); - vector> a; stack> st; + vector> a, st; for (int k = 1; l < r; l /= 2, r /= 2, k *= 2) { if (l&1) a.emplace_back(l++, k); - if (r&1) st.emplace(--r, k); + if (r&1) st.emplace_back(--r, k); } - while (!st.empty()) a.push_back(st.top()), st.pop(); + a.insert(a.begin(), st.rbegin(), st.rend()); for (auto [i, k] : a) { if (tree[i] >= x) return find(i, x, k); // Modify this } -- cgit v1.2.3