Safe Haskell | None |
---|---|
Language | GHC2021 |
Monoid action for setting interval \([l, r)\) over ideomponent monoids.
Since: 1.0.0
Synopsis
- newtype RangeAddId a = RangeAddId a
- new :: a -> RangeAddId a
- act :: Num a => RangeAddId a -> a -> a
RangeAddId
newtype RangeAddId a #
Range set monoid action.
Example
>>>
import AtCoder.Extra.Monoid (SegAct(..), RangeAddId(..))
>>>
import AtCoder.LazySegTree qualified as LST
>>>
import Data.Semigroup (Max(..))
>>>
seg <- LST.build @_ @(RangeAddId Int) @(Max Int) $ VU.generate 3 Max -- [0, 1, 2]
>>>
LST.applyIn seg 0 3 $ RangeAddId 5 -- [5, 6, 7]
>>>
getMax <$> LST.prod seg 0 3
7
Since: 1.0.0
Instances
Constructor
new :: a -> RangeAddId a #
Creates RangeAddId
.
Since: 1.0.0
Action
act :: Num a => RangeAddId a -> a -> a #
Applies one-length range add: \(f: x \rightarrow d + x\).
Since: 1.0.0