diff --git a/libs/segtree/src/lib.rs b/libs/segtree/src/lib.rs index 9b13d068..5c425931 100644 --- a/libs/segtree/src/lib.rs +++ b/libs/segtree/src/lib.rs @@ -7,11 +7,11 @@ //! //! The multiplication must be associative. //! -//! Furthermore, when this is used for [`SegtreeOfSegtrees`] or [`Dense2dSegtree`], the multiplication must be commutative. +//! Furthermore, when this is used for [`Sparse2dSegtree`] or [`Dense2dSegtree`], the multiplication must be commutative. //! //! # Modifier APIs //! -//! While [`Segtree`], [`SparseSegtree`], and [`Dense2dSegtree`] have `entry` API, [`SegtreeOfSegtrees`] does not have it. +//! While [`Segtree`], [`SparseSegtree`], and [`Dense2dSegtree`] have `entry` API, [`Sparse2dSegtree`] does not have it. //! Instead, it has `apply` API. You can apply a function $f$ that satisfies $f(x \cdot y) = x \cdot f(y)$ to a single element.. use core::fmt; @@ -265,11 +265,11 @@ impl Index for SparseSegtree { /// A segment tree of segment trees (2D segment tree). /// The multiplication must be commutative. -pub struct SegtreeOfSegtrees { +pub struct Sparse2dSegtree { segtrees: Vec>, keys: Vec, } -impl SegtreeOfSegtrees +impl Sparse2dSegtree where K: Ord + Clone, L: Ord + Clone, @@ -369,21 +369,21 @@ where } } -impl fmt::Debug for SegtreeOfSegtrees +impl fmt::Debug for Sparse2dSegtree where K: fmt::Debug, L: fmt::Debug, O::Value: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("SegtreeOfSegtrees") + f.debug_struct("Sparse2dSegtree") .field("segtrees", &self.segtrees) .field("keys", &self.keys) .finish() } } -impl FromIterator<(K, L, O::Value)> for SegtreeOfSegtrees +impl FromIterator<(K, L, O::Value)> for Sparse2dSegtree where K: Ord + Clone, L: Ord + Clone, @@ -394,7 +394,7 @@ where } } -impl Index for SegtreeOfSegtrees { +impl Index for Sparse2dSegtree { type Output = SparseSegtree; fn index(&self, i: K) -> &Self::Output { @@ -402,7 +402,7 @@ impl Index for SegtreeOfSegtrees { } } -impl Index<(K, L)> for SegtreeOfSegtrees { +impl Index<(K, L)> for Sparse2dSegtree { type Output = O::Value; fn index(&self, (i, j): (K, L)) -> &Self::Output { @@ -794,7 +794,7 @@ mod tests { }) .take(n) .collect::>(); - let mut segtree = SegtreeOfSegtrees::::new(&vec); + let mut segtree = Sparse2dSegtree::::new(&vec); for _ in 0..q { match rng.gen_range(0..1) { // fold