Skip to content

Commit

Permalink
replace a and b
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo314 committed Mar 8, 2024
1 parent adfda9e commit ba2a89f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cpp/merge-sort-tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,19 @@ class MergeSortTree {

value_type _prod_section(int l, int r, std::optional<key_type> a, std::optional<key_type> b) const {
value_type ret = e();
if (a.has_value()) {
int i = std::lower_bound(key_data.begin() + l, key_data.begin() + r, a.value(), comp) - key_data.begin();
if (i != l) {
ret = inv(cumulative_value[i - 1]);
}
}
if (b.has_value()) {
int i = std::lower_bound(key_data.begin() + l, key_data.begin() + r, b.value(), comp) - key_data.begin();
if (i != l) {
ret = op(ret, cumulative_value[i - 1]);
ret = cumulative_value[i - 1]
}
} else {
ret = op(ret, cumulative_value[r - 1]);
ret = cumulative_value[r - 1]
}
if (a.has_value()) {
int i = std::lower_bound(key_data.begin() + l, key_data.begin() + r, a.value(), comp) - key_data.begin();
if (i != l) {
ret = op(ret,inv(cumulative_value[i - 1]));
}
}
return ret;
}
Expand Down

0 comments on commit ba2a89f

Please sign in to comment.