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

AtCoder.Extra.Monoid.RangeAdd

Description

Monoid action for setting interval \([l, r)\).

Since: 1.0.0

Synopsis

RangeAdd

newtype RangeAdd a #

Range set monoid action.

Example

>>> import AtCoder.Extra.Monoid (SegAct(..), RangeAdd(..))
>>> import AtCoder.LazySegTree qualified as LST
>>> import Data.Semigroup (Max(..))
>>> seg <- LST.build @_ @(RangeAdd Int) @(Sum Int) $ VU.generate 3 Sum -- [0, 1, 2]
>>> LST.applyIn seg 0 3 $ RangeAdd 5 -- [5, 6, 7]
>>> getSum <$> LST.prod seg 0 3
18

Since: 1.0.0

Constructors

RangeAdd a 

Instances

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

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeAdd

Unbox a => MVector MVector (RangeAdd a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeAdd

Num a => Monoid (RangeAdd a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeAdd

Methods

mempty :: RangeAdd a #

mappend :: RangeAdd a -> RangeAdd a -> RangeAdd a #

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

Num a => Semigroup (RangeAdd a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeAdd

Methods

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

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

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

Show a => Show (RangeAdd a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeAdd

Methods

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

show :: RangeAdd a -> String #

showList :: [RangeAdd a] -> ShowS #

Eq a => Eq (RangeAdd a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeAdd

Methods

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

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

Ord a => Ord (RangeAdd a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeAdd

Methods

compare :: RangeAdd a -> RangeAdd a -> Ordering #

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

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

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

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

max :: RangeAdd a -> RangeAdd a -> RangeAdd a #

min :: RangeAdd a -> RangeAdd a -> RangeAdd a #

Unbox a => Unbox (RangeAdd a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeAdd

Num a => SegAct (RangeAdd a) (Sum a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeAdd

Methods

segAct :: RangeAdd a -> Sum a -> Sum a #

segActWithLength :: Int -> RangeAdd a -> Sum a -> Sum a #

newtype MVector s (RangeAdd a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeAdd

newtype MVector s (RangeAdd a) = MV_RangeAdd (MVector s a)
newtype Vector (RangeAdd a) #

Since: 1.0.0

Instance details

Defined in AtCoder.Extra.Monoid.RangeAdd

newtype Vector (RangeAdd a) = V_RangeAdd (Vector a)

Constructor

new :: a -> RangeAdd a #

Creates RangeAdd.

Since: 1.0.0

Action

act :: Num a => RangeAdd a -> a -> a #

Applies one-length range add: \(f: x \rightarrow d + x\).

Since: 1.0.0