Skip to content

Commit 964097a

Browse files
committed
shorten other test
1 parent 362ed04 commit 964097a

File tree

2 files changed

+9
-30
lines changed

2 files changed

+9
-30
lines changed

tests/library_checker_aizu_tests/trees/kth_path_linear.test.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"https://judge.yosupo.jp/problem/jump_on_tree"
33
#include "../template.hpp"
44
#include "../../../library/trees/linear_kth_path.hpp"
5+
#include "../../../library/trees/lca_rmq/lca_rmq.hpp"
6+
#include "../compress_tree_asserts.hpp"
57
int main() {
68
cin.tie(0)->sync_with_stdio(0);
79
int n, q;
@@ -14,6 +16,8 @@ int main() {
1416
adj[v].push_back(u);
1517
}
1618
linear_kth_path lin_kth_path(adj);
19+
LCA lc(adj);
20+
compress_tree_asserts(adj, lc);
1721
while (q--) {
1822
int u, v, k;
1923
cin >> u >> v >> k;

tests/library_checker_aizu_tests/trees/kth_path_tree_lift.test.cpp

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@
22
"https://judge.yosupo.jp/problem/jump_on_tree"
33
#include "../template.hpp"
44
#include "../../../library/contest/random.hpp"
5-
#include "../../../library/monotonic_stack/monotonic_stack.hpp"
65
#include "../../../library/trees/tree_lift/tree_lift.hpp"
76
#include "../../../library/trees/lca_rmq/lca_rmq.hpp"
8-
#include "../../../library/trees/linear_lca.hpp"
9-
#include "../../../library/trees/linear_kth_path.hpp"
10-
#include "../compress_tree_asserts.hpp"
117
int main() {
128
cin.tie(0)->sync_with_stdio(0);
139
int n, q;
@@ -21,42 +17,21 @@ int main() {
2117
}
2218
tree_lift tl(adj);
2319
LCA lc(adj);
24-
linear_kth_path lin_kth_path(adj);
25-
compress_tree_asserts(adj, lc);
2620
while (q--) {
2721
int u, v, k;
2822
cin >> u >> v >> k;
2923
int dist_in_edges = tl.dist_edges(u, v);
3024
assert(dist_in_edges == lc.dist_edges(u, v));
31-
assert(dist_in_edges ==
32-
lin_kth_path.lin_lca.dist_edges(u, v));
33-
int res = tl.kth_path(u, v, k);
34-
assert(res == lin_kth_path.kth_path(u, v, k));
35-
cout << res << '\n';
25+
cout << tl.kth_path(u, v, k) << '\n';
3626
{
3727
int w = rnd(0, n - 1);
3828
assert(lc.on_path(u, v, w) ==
39-
(lc.dist_edges(u, w) + lc.dist_edges(w, v) ==
40-
lc.dist_edges(u, v)));
29+
(lc.dist_edges(u, w) + lc.dist_edges(w, v) ==
30+
lc.dist_edges(u, v)));
4131
}
4232
if (u != v) {
43-
assert(tl.kth_path(u, v, 0) == u);
44-
assert(lin_kth_path.kth_path(u, v, 0) == u);
45-
assert(
46-
tl.kth_path(u, v, 1) == lc.next_on_path(u, v));
47-
assert(lin_kth_path.kth_path(u, v, 1) ==
48-
lc.next_on_path(u, v));
49-
assert(tl.kth_path(u, v, dist_in_edges - 1) ==
50-
lc.next_on_path(v, u));
51-
assert(
52-
lin_kth_path.kth_path(u, v, dist_in_edges - 1) ==
53-
lc.next_on_path(v, u));
54-
assert(tl.kth_path(u, v, dist_in_edges) == v);
55-
assert(
56-
lin_kth_path.kth_path(u, v, dist_in_edges) == v);
57-
assert(tl.kth_path(u, v, dist_in_edges + 1) == -1);
58-
assert(lin_kth_path.kth_path(u, v,
59-
dist_in_edges + 1) == -1);
33+
assert(tl.kth_path(u, v, 1) == lc.next_on_path(u, v));
34+
assert(tl.kth_path(u, v, dist_in_edges - 1) == lc.next_on_path(v, u));
6035
}
6136
}
6237
}

0 commit comments

Comments
 (0)