Skip to content

Commit c08e4dd

Browse files
committed
fix test
1 parent 24829a8 commit c08e4dd

File tree

1 file changed

+44
-3
lines changed

1 file changed

+44
-3
lines changed

tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ int main() {
77
cin.tie(0)->sync_with_stdio(0);
88
int n, q;
99
cin >> n >> q;
10-
tree st(n, array<int, 2>{1, 0},
10+
const array<int, 2> unit = {1, 0};
11+
tree st(n, unit,
1112
[&](const array<int, 2>& l,
1213
const array<int, 2>& r) -> array<int, 2> {
1314
return {int(1LL * l[0] * r[0] % mod),
@@ -30,8 +31,48 @@ int main() {
3031
cin >> l >> r >> x;
3132
assert(st.query(l, l) == st.unit);
3233
assert(st.query(r, r) == st.unit);
33-
auto [slope, y_int] = st.query(l, r);
34-
cout << (1LL * slope * x + y_int) % mod << '\n';
34+
array<int, 2> res = st.query(l, r);
35+
{
36+
array<int, 2> walk_res = {1, 0};
37+
int idx = st.max_right(l, r,
38+
[&](const array<int, 2>& curr_line) -> bool {
39+
walk_res = curr_line;
40+
return 1;
41+
});
42+
assert(res == walk_res);
43+
assert(idx == r);
44+
}
45+
{
46+
array<int, 2> walk_res = unit;
47+
int idx = st.max_right(l, r,
48+
[&](const array<int, 2>& curr_line) -> bool {
49+
walk_res = curr_line;
50+
return 0;
51+
});
52+
assert(walk_res == st.query(l, l + 1));
53+
assert(idx == l);
54+
}
55+
{
56+
array<int, 2> walk_res = unit;
57+
int idx = st.min_left(l, r,
58+
[&](const array<int, 2>& curr_line) -> bool {
59+
walk_res = curr_line;
60+
return 1;
61+
});
62+
assert(walk_res == res);
63+
assert(idx == l);
64+
}
65+
{
66+
array<int, 2> walk_res = unit;
67+
int idx = st.min_left(l, r,
68+
[&](const array<int, 2>& curr_line) -> bool {
69+
walk_res = curr_line;
70+
return 0;
71+
});
72+
assert(walk_res == st.query(r - 1, r));
73+
assert(idx == r);
74+
}
75+
cout << (1LL * res[0] * x + res[1]) % mod << '\n';
3576
}
3677
}
3778
return 0;

0 commit comments

Comments
 (0)