セグメント木 [詳解]
#include "segtree.hpp"
公開型 | |
using | Type = typename Monoid::Type |
公開メンバ関数 | |
SegTree ()=default | |
SegTree (int n) | |
要素数 n のセグ木を構築する | |
SegTree (const vector< Type > &v) | |
配列 v からセグ木を構築する | |
void | set (int i, Type x) |
i 番目の要素を x に変更する | |
Type | fold (int l, int r) |
区間 [l, r) のモノイド積を返す | |
template<typename F> | |
int | find_right (int l, F f) |
区間 [l, x) のモノイド積が f を満たすような最大の x >= l を返す | |
template<typename F> | |
int | find_left (int r, F f) |
区間 [x, r) のモノイド積が f を満たすような最小の x <= r を返す | |
Type | operator[] (int i) |
i 番目の要素を返す | |
int | size () |
配列のサイズを返す | |
using SegTree< Monoid >::Type = typename Monoid::Type |
segtree.hpp の 7 行目に定義があります。
要素数 n のセグ木を構築する
segtree.hpp の 11 行目に定義があります。
|
inline |
区間 [l, x) のモノイド積が f を満たすような最大の x >= l を返す
f(Monoid::id())=true
が成り立つ必要がある segtree.hpp の 52 行目に定義があります。
|
inline |
区間 [x, r) のモノイド積が f を満たすような最小の x <= r を返す
f(Monoid::id())=true
が成り立つ必要がある segtree.hpp の 88 行目に定義があります。
|
inline |
配列のサイズを返す
segtree.hpp の 125 行目に定義があります。