差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン次のリビジョン両方とも次のリビジョン | ||
programming_algorithm:data_structure:balancing_binary_search_tree:tree_free [2020/06/29] – [代替方法一覧] ikatakos | programming_algorithm:data_structure:balancing_binary_search_tree:tree_free [2020/09/03] – [Binary Indexed Tree] ikatakos | ||
---|---|---|---|
行 27: | 行 27: | ||
* 問題依存の上手い方法 | * 問題依存の上手い方法 | ||
* 列挙していけば何か共通点みたいなのが見つかるかも知れない | * 列挙していけば何か共通点みたいなのが見つかるかも知れない | ||
- | * '' | + | * %%C++%%コードを埋め込んで外部モジュールとしてコンパイル |
- | * うむ。 | + | * 下記、参考の3つめのリンク参照 |
* 参考 | * 参考 | ||
行 50: | 行 50: | ||
* 値 $x$ を追加 → $bit.add(x, 1)$ | * 値 $x$ を追加 → $bit.add(x, 1)$ | ||
* 値 $x$ を削除 → $bit.add(x, -1)$ | * 値 $x$ を削除 → $bit.add(x, -1)$ | ||
- | * $k$ 番目の値を取得 → 累積和が $k$ 以上になる最小のindexを取得 | + | * $k$ 番目の値を取得 → $bit.lower_bound(k)$(累積和が $k$ 以上になる最小のindexを取得) |
+ | * $x$ 以上の最小の値を取得 $bit.lower_bound(bit.sum(x - 1) + 1)$ | ||
^機能 | ^機能 | ||
行 147: | 行 148: | ||
++++ | ++++ | ||
- | === std::set解 === | + | === std::set解(想定解) |
std:: | std:: |