Skip to content

Commit 01c7ee7

Browse files
committed
fixes
1 parent 46444c6 commit 01c7ee7

2 files changed

Lines changed: 3 additions & 14 deletions

File tree

library/data_structures/dsu/kruskal_tree.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
struct kr_tree {
66
int id;
77
vi p;
8-
vector<pii> adj;
8+
vector<array<int, 2>> adj;
99
kr_tree(int n): id(n), p(2 * n, -1), adj(2 * n) {}
1010
int find(int v) {
1111
return p[v] < 0 ? v : p[v] = find(p[v]);

tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,6 @@ struct functional_graph_processor {
119119
vector<int> end; // [pos[u], end[u]) denotes the subtree
120120
vector<int> size; // size of the subtree in abr
121121
};
122-
bool equal(const basic_string<int> &a, const vi &b) {
123-
if (sz(a) != sz(b)) return 0;
124-
for (int i = 0; i < sz(a); i++)
125-
if (a[i] != b[i]) return 0;
126-
return 1;
127-
}
128122
int main() {
129123
cin.tie(0)->sync_with_stdio(0);
130124
for (int num_tests = 100; num_tests--;) {
@@ -133,17 +127,12 @@ int main() {
133127
for (int i = 0; i < n; i++) a[i] = rnd(0, n - 1);
134128
auto [root_of, cycle, childs] = func_graph(a);
135129
functional_graph_processor fgp(a);
136-
assert(sz(cycle) == sz(fgp.cycle));
137-
for (int i = 0; i < sz(cycle); i++) {
138-
assert(sz(cycle[i]) == sz(fgp.cycle[i]));
139-
for (int j = 0; j < sz(cycle[i]); j++)
140-
assert(cycle[i][j] == fgp.cycle[i][j]);
141-
}
130+
assert(cycle == fgp.cycle);
131+
assert(childs == fgp.abr);
142132
for (int i = 0; i < n; i++) {
143133
int root =
144134
cycle[root_of[i].first][root_of[i].second];
145135
assert(root == fgp.root_of[i]);
146-
assert(equal(childs[i], fgp.abr[i]));
147136
assert((root == i) == (fgp.cycle_id[i] != -1));
148137
if (root == i) {
149138
assert(root_of[i].first == fgp.cycle_id[i]);

0 commit comments

Comments
 (0)