まぐげんがーの競プロライブラリです。
-
- Randint.hpp (
std::mt19937
を使った乱数生成) - Timer.hpp(
std::chrono
を使った時間計測)
- Randint.hpp (
-
- FastIO.hpp(
read
とputchar_unlocked
を使った高速入出力std::cin
,std::cout
のおよそ2~5倍の実行速度)
- FastIO.hpp(
-
- Argsort.hpp (偏角ソートをするときに
std::sort
に渡す関数) - Combination.hpp (
nCr
,nPr
,nHr
などを前計算ありO(1)
で求める) - DivisorList.hpp (約数列挙。返り値は
std::vector<T>
型) - ModInt.hpp (※Integers.hppに移動しました modint。ACLの方が高性能)
- PrimeFactor.hpp (素因数分解。
O(sqrt(N))
) - PrimeFactorPollard.hpp (ポラードのρ法を使った素因数分解。補助関数として
IP (is_prime)
,PM (pow_mod)
がある)
- Argsort.hpp (偏角ソートをするときに
-
-
Integers.hpp (符号あり128bit整数のラッパー
cent_t
とi8 ~ i64
,u8 ~ u64
を定義 + modint) -
others.hpp (競プロ用のテンプレート。includeのテンプレ、マクロ、デバッグとか)
-
gridtoInt.hpp (グリッドに数字を割り振る便利関数。後でothers.hppに統合するかも?)
-
-
- BinaryIndexedTree.hpp (BIT / Fenwick tree。0-Indexed。)
- CompressVec.hpp (
std::vector
を渡すと座標圧縮してくれる) - Cumsum.hpp (累積和)
- RollingHash.hpp (ローリングハッシュ。法はデフォルトが
1e9 + 7
、好きな数にもできる) - SegmentTree.hpp (セグメント木。
struct{ using valueType = SomeType; static SomeType op(SomeType a, SomeType b){}; static inline SomeType id{}; }
みたいな構造体でモノイドを定義してる) - Trie.hpp (Trie木 / Prefix Tree)
- UndoUnionFind.hpp (操作取消可能UF。再帰数え上げの時とかに使う。)
- UnionFind.hpp (ユニオンファインド。
groups()
もある。) - WeightedUnionFind.hpp (重み付きUF。)