pub struct LazySegtree<M: Monoid, A: Act<M>> { /* private fields */ }Expand description
モノイド列の区間更新・区間取得($O(\log n)$, $O(\log n)$)ができる。
Implementations§
Source§impl<M, A> LazySegtree<M, A>
impl<M, A> LazySegtree<M, A>
Sourcepub fn new(monoid: M, act: A, n: usize) -> Self
pub fn new(monoid: M, act: A, n: usize) -> Self
長さnのLazySegtreeを生成する。
Sourcepub fn from_vec(monoid: M, act: A, s: Vec<M::Element>) -> Self
pub fn from_vec(monoid: M, act: A, s: Vec<M::Element>) -> Self
VecからLazySegtreeを構築する。
Time complexity $O(|s|)$
Sourcepub fn fold(&mut self, range: impl RangeBounds<usize>) -> M::Element
pub fn fold(&mut self, range: impl RangeBounds<usize>) -> M::Element
区間rangeで計算を集約して返す。
Sourcepub fn update(&mut self, range: impl RangeBounds<usize>, x: A::Element)
pub fn update(&mut self, range: impl RangeBounds<usize>, x: A::Element)
区間rangeを値xで更新する。
Auto Trait Implementations§
impl<M, A> Freeze for LazySegtree<M, A>
impl<M, A> RefUnwindSafe for LazySegtree<M, A>where
M: RefUnwindSafe,
A: RefUnwindSafe,
<M as Set>::Element: RefUnwindSafe,
<A as Act<M>>::Element: RefUnwindSafe,
impl<M, A> Send for LazySegtree<M, A>
impl<M, A> Sync for LazySegtree<M, A>
impl<M, A> Unpin for LazySegtree<M, A>
impl<M, A> UnwindSafe for LazySegtree<M, A>where
M: UnwindSafe,
A: UnwindSafe,
<M as Set>::Element: UnwindSafe,
<A as Act<M>>::Element: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more