|
6 | 6 | #include "../../../library/data_structures/dsu/dsu_restorable.hpp" |
7 | 7 | #include "../../../library/trees/tree_lift/tree_lift.hpp" |
8 | 8 | #include "../../../library/trees/centroid_decomp_uncommon/count_paths_per_length.hpp" |
| 9 | +#include "../cd_asserts.hpp" |
9 | 10 | vector<vector<ll>> naive(const vector<vector<int>>& adj, |
10 | | - dsu_restorable& dsu) { |
| 11 | + dsu_restorable& dsu) { |
11 | 12 | tree_lift tl(adj); |
12 | 13 | int n = sz(adj); |
13 | 14 | vector<vector<ll>> cnts_naive(n + 1, vector<ll>(n, 0)); |
@@ -37,16 +38,17 @@ int main() { |
37 | 38 | adj[v].push_back(u); |
38 | 39 | } |
39 | 40 | } |
| 41 | + cd_asserts(adj); |
40 | 42 | vector<vector<ll>> cnts_naive = naive(adj, dsu); |
41 | 43 | for (int k = 1; k <= n; k++) |
42 | 44 | assert( |
43 | | - count_paths_per_node(adj, k) == cnts_naive[k]); |
| 45 | + count_paths_per_node(adj, k) == cnts_naive[k]); |
44 | 46 | vector<ll> num_paths_len = count_paths_per_length(adj); |
45 | 47 | for (int k = 1; k < n; k++) { |
46 | 48 | vector<ll> count_paths = |
47 | | - count_paths_per_node(adj, k); |
| 49 | + count_paths_per_node(adj, k); |
48 | 50 | ll total_paths = accumulate(begin(count_paths), |
49 | | - end(count_paths), 0LL); |
| 51 | + end(count_paths), 0LL); |
50 | 52 | assert(total_paths % (k + 1) == 0); |
51 | 53 | total_paths /= k + 1; |
52 | 54 | assert(num_paths_len[k] == total_paths); |
|
0 commit comments