長さ
- 要素の1点変更
- 区間の要素の総和
を
public FenwickTree(int n)長さ
public FenwickTree(long[] data)長さ data により初期化します.
計算量:
public void add(int p, long x)配列の第$p$要素に$x$を加える. すなわち, a[p] += x のこと.
計算量:
public void set(int p, long x)配列の第$p$要素を$x$に変更する. すなわち, a[p] = x のこと.
計算量:
public long get(int p)配列の第$p$要素を取得する. 計算量:
public long sum(int l, int r)[[https://atcoder.jp/contests/practice2/submissions/16573339]]