Skip to content

Commit cc38fbb

Browse files
committed
fixing some tests
1 parent 24e6259 commit cc38fbb

5 files changed

Lines changed: 8 additions & 29 deletions

File tree

library/data_structures_[l,r)/bit_uncommon/walk.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
int walk2(ll sum) {
1+
int walk(ll sum) {
22
if (sum <= 0) return -1;
33
int r = 0;
44
for (int i = bit_floor(size(s)); i; i /= 2)

tests/library_checker_aizu_tests/data_structures/bit.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int main() {
5858
}
5959
return 1;
6060
};
61-
assert(bit.walk2(sum) == st.find_first(0, n, f));
61+
assert(bit.walk(sum) == st.find_first(0, n, f));
6262
}
6363
return 0;
6464
}

tests/library_checker_aizu_tests/data_structures/bit_ordered_set.test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ int main() {
4040
x = get_compressed_idx(x);
4141
if (bit.query(x, x) == 1) bit.update(x, -1);
4242
} else if (type == 2) {
43-
int res = bit.walk2(x);
43+
int res = bit.walk(x);
4444
if (res == -1 || res == sz(compress))
4545
cout << -1 << '\n';
4646
else cout << compress[res] << '\n';
@@ -49,12 +49,12 @@ int main() {
4949
cout << bit.query(x) << '\n';
5050
} else if (type == 4) {
5151
x = get_compressed_idx(x);
52-
int res = bit.walk2(bit.query(x));
52+
int res = bit.walk(bit.query(x));
5353
if (res == -1) cout << -1 << '\n';
5454
else cout << compress[res] << '\n';
5555
} else {
5656
x = get_compressed_idx(x);
57-
int res = bit.walk2(bit.query(x - 1) + 1);
57+
int res = bit.walk(bit.query(x - 1) + 1);
5858
if (res == sz(bit.s)) cout << -1 << '\n';
5959
else cout << compress[res] << '\n';
6060
}

tests/library_checker_aizu_tests/data_structures/bit_walk.test.cpp

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,13 @@ int main() {
4646
}
4747
return 1;
4848
};
49-
int res = bit.walk2(order + 1);
49+
int res = bit.walk(order + 1);
5050
assert(res == st.find_first(0, n, f));
5151
assert(res == st.find_first(k, n,
5252
[&](ll x, int, int) -> bool {
5353
return x > 0;
5454
}));
5555
if (res == n) res = -1;
56-
int res_lambda = -1;
57-
bit.walk([&](int r, ll sum) {
58-
if (sum > order) {
59-
res_lambda = r - 1;
60-
return 0;
61-
}
62-
return 1;
63-
});
64-
assert(res == res_lambda);
6556
cout << res << '\n';
6657
} else {
6758
if (bit.query(k, k + 1) == 1) {
@@ -78,24 +69,12 @@ int main() {
7869
}
7970
return 1;
8071
};
81-
int res = bit.walk2(order);
72+
int res = bit.walk(order);
8273
assert(max(res, 0) == st.find_first(0, n, f));
8374
assert(res == st.find_last(0, k + 1,
8475
[&](ll x, int, int) -> bool {
8576
return x > 0;
8677
}));
87-
int res_lambda = -1;
88-
if (order) {
89-
bit.walk([&](int r, ll sum) {
90-
if (sum < order) {
91-
res_lambda = r;
92-
return 1;
93-
}
94-
res_lambda = r - 1;
95-
return 0;
96-
});
97-
}
98-
assert(res == res_lambda);
9978
cout << res << '\n';
10079
}
10180
}

tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int main() {
3737
rngs.push_back({tl, tr, 1});
3838
return 1;
3939
};
40-
int pos = min(bit.walk2(bit.query(l) + sum), r);
40+
int pos = min(bit.walk(bit.query(l) + sum), r);
4141
reset();
4242
assert(pos == seg.find_first(l, r, f));
4343
assert(!empty(rngs));

0 commit comments

Comments
 (0)