Skip to content

Commit 3a01988

Browse files
committed
add another assert
1 parent effe351 commit 3a01988

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/library_checker_aizu_tests/edge_cd_asserts.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ void edge_cd_asserts(const vector<vi>& adj, int cent,
1212
assert(sz_all >= 3);
1313
array<int, 2> cnts = {0, 0};
1414
array<int, 2> max_cnt = {0, 0};
15+
array<int, 2> number_of_cnts = {0, 0};
1516
for (int i = 0; i < sz(adj[cent]); i++) {
1617
int sz_subtree = dfs(dfs, adj[cent][i], cent);
1718
assert(2 * sz_subtree <= sz_all);
1819
cnts[i < split] += sz_subtree;
1920
max_cnt[i < split] =
2021
max(max_cnt[i < split], sz_subtree);
22+
number_of_cnts[i < split]++;
2123
}
2224
assert(cnts[0] + cnts[1] + 1 == sz_all);
2325
if (sz_all == 4) return;
@@ -32,8 +34,10 @@ void edge_cd_asserts(const vector<vi>& adj, int cent,
3234
if (cnts[0] > cnts[1]) {
3335
swap(cnts[0], cnts[1]);
3436
swap(max_cnt[0], max_cnt[1]);
37+
swap(number_of_cnts[0], number_of_cnts[1]);
3538
}
3639
if (!is_balanced(cnts[0], cnts[1])) {
40+
assert(number_of_cnts[1] == 2);
3741
int a = max_cnt[1];
3842
int b = cnts[1] - max_cnt[1];
3943
assert(a > 0);

0 commit comments

Comments
 (0)