summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/datastructures/persistent.cpp2
-rw-r--r--content/graph/virtualTree.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/content/datastructures/persistent.cpp b/content/datastructures/persistent.cpp
index 7d15342..f26680d 100644
--- a/content/datastructures/persistent.cpp
+++ b/content/datastructures/persistent.cpp
@@ -7,7 +7,7 @@ struct persistent {
: time(time), data(1, {2*time, value}) {}
T get(int t) {
- return prev(upper_bound(all(data), pair{2*t+1, T{}}))->second;
+ return prev(upper_bound(all(data),pair{2*t+1, T{}}))->second;
}
int set(T value) {
diff --git a/content/graph/virtualTree.cpp b/content/graph/virtualTree.cpp
index 27d2d6c..6233b27 100644
--- a/content/graph/virtualTree.cpp
+++ b/content/graph/virtualTree.cpp
@@ -3,13 +3,13 @@ vector<int> in, out;
void virtualTree(vector<int> ind) { // indices of used nodes
sort(all(ind), [&](int x, int y) {return in[x] < in[y];});
- for (int i = 0, n = sz(ind); i < n - 1; i++) {
- ind.push_back(lca(ind[i], ind[i + 1]));
+ for (int i = 1, n = sz(ind); i < n; i++) {
+ ind.push_back(lca(ind[i - 1], ind[i]));
}
sort(all(ind), [&](int x, int y) {return in[x] < in[y];});
ind.erase(unique(all(ind)), ind.end());
- int n = ind.size();
+ int n = sz(ind);
vector<vector<int>> tree(n);
vector<int> st = {0};
for (int i = 1; i < n; i++) {