File tree Expand file tree Collapse file tree
tests/library_checker_aizu_tests/data_structures Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ int main() {
88 vector<int > a (n);
99 for (int i = 0 ; i < n; i++) cin >> a[i];
1010 linear_rmq rmq_less (a, less ());
11+ linear_rmq rmq_less_equal (a, less_equal ());
12+ vector<int > neg_a (n);
13+ for (int i = 0 ; i < n; i++) neg_a[i] = -a[i];
14+ linear_rmq rmq_greater (neg_a, greater ());
15+ linear_rmq rmq_greater_equal (neg_a, greater_equal ());
1116 while (q--) {
1217 int l, r;
1318 cin >> l >> r;
@@ -17,6 +22,16 @@ int main() {
1722 a[idx_right_min]);
1823 assert (l <= idx_right_min && idx_right_min < r);
1924 assert (rmq_less.query (l, r - 1 ) == a[idx_right_min]);
25+ assert (idx_right_min == rmq_greater.idx (l, r - 1 ));
26+ int idx_left_min = rmq_less_equal.idx (l, r - 1 );
27+ assert (l == idx_left_min ||
28+ rmq_less_equal.query (l, idx_left_min - 1 ) >
29+ a[idx_left_min]);
30+ assert (l <= idx_left_min && idx_left_min < r);
31+ assert (
32+ idx_left_min == rmq_greater_equal.idx (l, r - 1 ));
33+ assert (a[idx_right_min] == a[idx_left_min]);
34+ assert (idx_left_min <= idx_right_min);
2035 cout << a[idx_right_min] << ' \n ' ;
2136 }
2237}
You can’t perform that action at this time.
0 commit comments