Skip to content

Commit 0c9455f

Browse files
committed
move speed test to edge CD
1 parent 964097a commit 0c9455f

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

tests/library_checker_aizu_tests/trees/count_paths_per_length.test.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
"https://judge.yosupo.jp/problem/frequency_table_of_tree_distance"
33
#include "../template.hpp"
44
#include "../cd_asserts.hpp"
5-
#include "../../../library/contest/random.hpp"
6-
#include "../../../library/trees/centroid_decomp_uncommon/count_paths_per_node.hpp"
75
#include "../../../library/trees/centroid_decomp_uncommon/count_paths_per_length.hpp"
86
int main() {
97
cin.tie(0)->sync_with_stdio(0);
@@ -18,14 +16,6 @@ int main() {
1816
}
1917
cd_asserts(adj);
2018
vector<ll> cnt_len = count_paths_per_length(adj);
21-
if (n >= 2) {
22-
int k = rnd(1, n - 1);
23-
vector<ll> count_paths = count_paths_per_node(adj, k);
24-
ll sum = accumulate(begin(count_paths),
25-
end(count_paths), 0LL);
26-
assert(sum % (k + 1) == 0);
27-
assert(sum / (k + 1) == cnt_len[k]);
28-
}
2919
for (int i = 1; i < n; i++) cout << cnt_len[i] << " ";
3020
cout << '\n';
3121
return 0;

tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include "../template.hpp"
44
#include "../edge_cd_asserts.hpp"
55
#include "../../../library/trees/edge_centroid_decomp_uncommon/count_paths_per_length.hpp"
6+
#include "../../../library/contest/random.hpp"
7+
#include "../../../library/trees/centroid_decomp_uncommon/count_paths_per_node.hpp"
68
int main() {
79
cin.tie(0)->sync_with_stdio(0);
810
int n;
@@ -16,6 +18,13 @@ int main() {
1618
}
1719
{ edge_cd(adj, edge_cd_asserts); }
1820
vector<ll> cnt_len = count_paths_per_length(adj);
21+
if (n >= 2) {
22+
int k = rnd(1, n - 1);
23+
vector<ll> count_paths = count_paths_per_node(adj, k);
24+
ll sum = accumulate(begin(count_paths), end(count_paths), 0LL);
25+
assert(sum % (k + 1) == 0);
26+
assert(sum / (k + 1) == cnt_len[k]);
27+
}
1928
for (int i = 1; i < n; i++) cout << cnt_len[i] << " ";
2029
cout << '\n';
2130
return 0;

0 commit comments

Comments
 (0)