ac-library-hs-0.1.0.0: Data structures and algorithms
Safe HaskellNone
LanguageGHC2021

AtCoder.Extra.Monoid.RangeSet

Description

SegAct instance of range set action. It can set an interval \([l, r)\) to the same monoid \(x\) such as Sum Int.

Since: 1.0.0

Synopsis

RangeSet

newtype RangeSet a #

SegAct instance of range set action.

Example

>>> import AtCoder.Extra.Monoid (SegAct(..), RangeSet(..))
>>> import AtCoder.LazySegTree qualified as LST
>>> import Data.Semigroup (Product(..))
>>> seg <- LST.build @_ @(RangeSet (Product Int)) @(Product Int) $ VU.generate 4 Product -- [0, 1, 2, 3]
>>> LST.applyIn seg 0 3 $ RangeSet (True, Product 5) -- [5, 5, 5, 3]
>>> getProduct <$> LST.prod seg 0 4
375

Since: 1.0.0

Constructors

RangeSet (RangeSetRepr a) 

Instances

Instances details
Unbox a => Vector Vector (RangeSet a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeSet

Unbox a => MVector MVector (RangeSet a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeSet

Monoid a => Monoid (RangeSet a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeSet

Methods

mempty :: RangeSet a #

mappend :: RangeSet a -> RangeSet a -> RangeSet a #

mconcat :: [RangeSet a] -> RangeSet a #

Semigroup (RangeSet a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeSet

Methods

(<>) :: RangeSet a -> RangeSet a -> RangeSet a #

sconcat :: NonEmpty (RangeSet a) -> RangeSet a #

stimes :: Integral b => b -> RangeSet a -> RangeSet a #

Show a => Show (RangeSet a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeSet

Methods

showsPrec :: Int -> RangeSet a -> ShowS #

show :: RangeSet a -> String #

showList :: [RangeSet a] -> ShowS #

Eq a => Eq (RangeSet a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeSet

Methods

(==) :: RangeSet a -> RangeSet a -> Bool #

(/=) :: RangeSet a -> RangeSet a -> Bool #

Ord a => Ord (RangeSet a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeSet

Methods

compare :: RangeSet a -> RangeSet a -> Ordering #

(<) :: RangeSet a -> RangeSet a -> Bool #

(<=) :: RangeSet a -> RangeSet a -> Bool #

(>) :: RangeSet a -> RangeSet a -> Bool #

(>=) :: RangeSet a -> RangeSet a -> Bool #

max :: RangeSet a -> RangeSet a -> RangeSet a #

min :: RangeSet a -> RangeSet a -> RangeSet a #

Unbox a => Unbox (RangeSet a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeSet

Monoid a => SegAct (RangeSet a) a #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeSet

Methods

segAct :: RangeSet a -> a -> a #

segActWithLength :: Int -> RangeSet a -> a -> a #

newtype MVector s (RangeSet a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeSet

newtype MVector s (RangeSet a) = MV_RangeSet (MVector s (RangeSetRepr a))
newtype Vector (RangeSet a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeSet

newtype Vector (RangeSet a) = V_RangeSet (Vector (RangeSetRepr a))

Constructor

new :: a -> RangeSet a #

Creates a new RangeSet action.

Since: 1.0.0

Action

act :: RangeSet a -> a -> a #

Applies one-length range set: \(f: x \rightarrow y\).

Since: 1.0.0