Struct LazySegtree

Source
pub struct LazySegtree<A: Action> { /* private fields */ }
Expand description

モノイド列の区間更新・区間取得($O(\log n)$, $O(\log n)$)ができる。

Implementations§

Source§

impl<A: Action> LazySegtree<A>

Source

pub fn new(n: usize) -> Self

長さnLazySegtreeを生成する。

Source

pub fn from_vec(s: Vec<A::Output>) -> Self

VecからLazySegtreeを構築する。

Time complexity $O(|s|)$

Source

pub fn to_slice(&mut self) -> &[A::Output]

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

Time complexity $O(n)$

Source

pub fn get(&mut self, i: usize) -> A::Output

i番目の値を返す。

Source

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

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

Source

pub fn assign(&mut self, i: usize, value: A::Output)

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

Source

pub fn update(&mut self, range: impl RangeBounds<usize>, x: A::Lazy)

区間rangeを値xで更新する。

Auto Trait Implementations§

§

impl<A> Freeze for LazySegtree<A>

§

impl<A> RefUnwindSafe for LazySegtree<A>

§

impl<A> Send for LazySegtree<A>
where <A as Action>::Output: Send, <A as Action>::Lazy: Send,

§

impl<A> Sync for LazySegtree<A>
where <A as Action>::Output: Sync, <A as Action>::Lazy: Sync,

§

impl<A> Unpin for LazySegtree<A>
where <A as Action>::Output: Unpin, <A as Action>::Lazy: Unpin,

§

impl<A> UnwindSafe for LazySegtree<A>
where <A as Action>::Output: UnwindSafe, <A as Action>::Lazy: 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.