Struct LazySegtree

Source
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>
where M: Monoid, A: Act<M>, M::Element: Clone, A::Element: Clone + PartialEq,

Source

pub fn new(monoid: M, act: A, n: usize) -> Self

長さnLazySegtreeを生成する。

Source

pub fn from_vec(monoid: M, act: A, s: Vec<M::Element>) -> Self

VecからLazySegtreeを構築する。

Time complexity $O(|s|)$

Source

pub fn to_slice(&mut self) -> &[M::Element]

遅延操作を完了させたモノイド列をスライスで返す。

Time complexity $O(n)$

Source

pub fn get(&mut self, i: usize) -> M::Element

i番目の値を返す。

Source

pub fn fold(&mut self, range: impl RangeBounds<usize>) -> M::Element

区間rangeで計算を集約して返す。

Source

pub fn assign(&mut self, i: usize, value: M::Element)

i番目の値をvalueで置き換える。

Source

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>
where M: Freeze, A: Freeze,

§

impl<M, A> RefUnwindSafe for LazySegtree<M, A>

§

impl<M, A> Send for LazySegtree<M, A>
where M: Send, A: Send, <M as Set>::Element: Send, <A as Act<M>>::Element: Send,

§

impl<M, A> Sync for LazySegtree<M, A>
where M: Sync, A: Sync, <M as Set>::Element: Sync, <A as Act<M>>::Element: Sync,

§

impl<M, A> Unpin for LazySegtree<M, A>
where M: Unpin, A: Unpin, <M as Set>::Element: Unpin, <A as Act<M>>::Element: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.