Skip to content

Latest commit

 

History

History
63 lines (40 loc) · 1.89 KB

File metadata and controls

63 lines (40 loc) · 1.89 KB

SegmentTree

A segment tree template, supports lazy propagation (range modify, range query), you only have to implement two key functions, you can use lambda for these two functions.

SAM

A suffix automaton template which supports arbitary character type, can construct the SAM and the parent tree.

BIT

A binary indexed tree (Fenwick tree) template which supports element addition, query prefix sum. You only need to implement "add two values", lambda is supported. You can clear it in O(1).

MonotonousQueue

Get the maximum value in a FIFO queue in linear time.

ModInt

Integer modulo an number.

ConstantModInt

A faster ModInt with a compile-time constant modulo as a template parameter.

HLD

The heavy-light decomposition of a tree. Can be used to perform operations on paths.

SparseTable

Sparse table can be used to get the "sum" of an interval in O(nlogn)-O(1), where the "sum" behaves like a function of a (non-multi) set. For example, min and gcd.