更新 O(1) クエリ O(sqrt(N)) の改造版セグ木 [詳解]
#include "sqrt_tree.hpp"
公開型 | |
using | Type = typename Abel::Type |
公開メンバ関数 | |
SqrtTree ()=default | |
SqrtTree (int n) | |
SqrtTree (const vector< Type > &v) | |
配列 v で初期化する | |
SqrtTree (const vector< Type > &v, const vector< Type > &v_inv) | |
配列 v とその逆元 v_inv で初期化する | |
void | set (int i, Type x) |
i 番目の要素を x に更新する | |
void | set (int i, Type x, Type x_inv) |
i 番目の要素を x に更新し、その逆元を x_inv に更新する | |
Type | fold (int l, int r) |
区間 [l, r) の群積を返す | |
Type | operator[] (int i) const |
int | size () const |
更新 O(1) クエリ O(sqrt(N)) の改造版セグ木
Mo's Algorithmとの相性が良い
sqrt_tree.hpp の 8 行目に定義があります。
using SqrtTree< Abel >::Type = typename Abel::Type |
sqrt_tree.hpp の 9 行目に定義があります。
|
default |
|
inline |
sqrt_tree.hpp の 12 行目に定義があります。
|
inline |
配列 v で初期化する
sqrt_tree.hpp の 22 行目に定義があります。
|
inline |
配列 v とその逆元 v_inv で初期化する
sqrt_tree.hpp の 37 行目に定義があります。
i 番目の要素を x に更新し、その逆元を x_inv に更新する
sqrt_tree.hpp の 62 行目に定義があります。
sqrt_tree.hpp の 86 行目に定義があります。
|
inline |
sqrt_tree.hpp の 87 行目に定義があります。