Skip to content

Commit 43aa95e

Browse files
committed
fix another compile error
1 parent 1ddfcf7 commit 43aa95e

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

tests/library_checker_aizu_tests/trees/kth_path_tree_lift.test.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,29 @@ int main() {
1717
}
1818
tree_lift tl(adj);
1919
LCA lc(adj);
20+
auto kth_path = [&](int u, int v, int k) -> int {
21+
int lca_d = lc.d[lc.lca(u, v)];
22+
int u_lca = lc.d[u] - lca_d;
23+
int v_lca = lc.d[v] - lca_d;
24+
if (k <= u_lca) return tl.kth_par(u, k);
25+
if (k <= u_lca + v_lca)
26+
return tl.kth_par(v, u_lca + v_lca - k);
27+
return -1;
28+
};
2029
while (q--) {
2130
int u, v, k;
2231
cin >> u >> v >> k;
23-
int dist_in_edges = tl.dist_edges(u, v);
24-
assert(dist_in_edges == lc.dist_edges(u, v));
25-
cout << tl.kth_path(u, v, k) << '\n';
32+
int dist_in_edges = tl.dist(u, v);
33+
assert(dist_in_edges == lc.dist(u, v));
34+
cout << kth_path(u, v, k) << '\n';
2635
{
2736
int w = rnd(0, n - 1);
2837
assert(lc.on_path(u, v, w) ==
29-
(lc.dist_edges(u, w) + lc.dist_edges(w, v) ==
30-
lc.dist_edges(u, v)));
38+
(lc.dist(u, w) + lc.dist(w, v) == lc.dist(u, v)));
3139
}
3240
if (u != v) {
33-
assert(
34-
tl.kth_path(u, v, 1) == lc.next_on_path(u, v));
35-
assert(tl.kth_path(u, v, dist_in_edges - 1) ==
41+
assert(kth_path(u, v, 1) == lc.next_on_path(u, v));
42+
assert(kth_path(u, v, dist_in_edges - 1) ==
3643
lc.next_on_path(v, u));
3744
}
3845
}

tests/library_checker_aizu_tests/trees/lca_all_methods_lib_checker.test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ int main() {
2424
assert(lc.lca(i, i) == i);
2525
assert(lc.in_subtree(i, i));
2626
assert(lin_lca.lca(i, i) == i);
27-
assert(lc.t[lc.rmq.dp[0][i]].in == i &&
28-
lc.rmq.dp[0][lc.t[i].in] == i);
27+
assert(lc.in[lc.rmq.dp[0][i]] == i &&
28+
lc.rmq.dp[0][lc.in[i]] == i);
2929
}
3030
while (q--) {
3131
int u, v;

0 commit comments

Comments
 (0)