長さ の long 型配列に対し、
を の時間で求めることができるデータ構造です。
public FenwickTree(int n)
長さ の配列 を作ります。
初期値はすべて です。
計算量
public FenwickTree(long[] data)
長さ の配列 を data により初期化します。
計算量
public void add(int p, long x)
配列の第 要素に を加えます。 すなわち、 と同義です。
計算量
public void set(int p, long x)
配列の第 要素を に変更します。 すなわち、 と同義です。
計算量
public long get(int p)
配列の第 要素を取得します。
計算量
public long sum(int l, int r)
の値を返します。
計算量
[[https://atcoder.jp/contests/practice2/submissions/16573339]]