Skip to content

Commit

Permalink
segtree: get_slice
Browse files Browse the repository at this point in the history
  • Loading branch information
mizar committed Mar 27, 2023
1 parent 1917781 commit 1c9d4a6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/segtree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ impl<M: Monoid> Segtree<M> {
self.d[p + self.size].clone()
}

pub fn get_slice(&self) -> &[M::S] {
&self.d[self.size..(self.size + self.n)]
}

pub fn prod(&self, mut l: usize, mut r: usize) -> M::S {
assert!(l <= r && r <= self.n);
let mut sml = M::identity();
Expand Down

0 comments on commit 1c9d4a6

Please sign in to comment.